Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.

Commit bde1ceb

Browse files
author
Dónal Murtagh
committed
Fixes #55 If you select an image, remove it, then select it again, nothing happens
1 parent db19b63 commit bde1ceb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/component/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ReactImageUploadComponent extends React.Component {
2323
};
2424
this.inputElement = '';
2525
this.onDropFile = this.onDropFile.bind(this);
26+
this.onUploadClick = this.onUploadClick.bind(this);
2627
this.triggerFileUpload = this.triggerFileUpload.bind(this);
2728
}
2829

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

37+
onUploadClick(e) {
38+
// Fixes https://github.com/JakeHartnell/react-images-upload/issues/55
39+
e.target.value = null;
40+
}
41+
3642
/*
3743
Handle file validation
3844
*/
@@ -207,6 +213,7 @@ class ReactImageUploadComponent extends React.Component {
207213
name={this.props.name}
208214
multiple={!this.props.singleImage}
209215
onChange={this.onDropFile}
216+
onClick={this.onUploadClick}
210217
accept={this.props.accept}
211218
/>
212219
{ this.props.withPreview ? this.renderPreview() : null }

0 commit comments

Comments
 (0)