Skip to content

Commit

Permalink
Fixes JakeHartnell#55 If you select an image, remove it, then select …
Browse files Browse the repository at this point in the history
…it again, nothing happens
  • Loading branch information
Dónal Murtagh committed Jul 2, 2018
1 parent db19b63 commit bde1ceb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ReactImageUploadComponent extends React.Component {
};
this.inputElement = '';
this.onDropFile = this.onDropFile.bind(this);
this.onUploadClick = this.onUploadClick.bind(this);
this.triggerFileUpload = this.triggerFileUpload.bind(this);
}

Expand All @@ -33,6 +34,11 @@ class ReactImageUploadComponent extends React.Component {
this.inputElement.click();
}

onUploadClick(e) {
// Fixes https://github.com/JakeHartnell/react-images-upload/issues/55
e.target.value = null;
}

/*
Handle file validation
*/
Expand Down Expand Up @@ -207,6 +213,7 @@ class ReactImageUploadComponent extends React.Component {
name={this.props.name}
multiple={!this.props.singleImage}
onChange={this.onDropFile}
onClick={this.onUploadClick}
accept={this.props.accept}
/>
{ this.props.withPreview ? this.renderPreview() : null }
Expand Down

0 comments on commit bde1ceb

Please sign in to comment.