Skip to content

Commit

Permalink
fix(FileUploader): respect multiple prop in default file uploader (#5492
Browse files Browse the repository at this point in the history
)
  • Loading branch information
emyarod authored Mar 3, 2020
1 parent 667ef3a commit 0e10c10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions packages/react/src/components/FileUploader/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,14 @@ export default class FileUploader extends Component {

handleChange = evt => {
evt.stopPropagation();
const filenames = Array.prototype.map.call(
evt.target.files,
file => file.name
);
this.setState({
filenames: this.state.filenames.concat(
Array.prototype.map.call(evt.target.files, file => file.name)
),
filenames: this.props.multiple
? this.state.filenames.concat(filenames)
: filenames,
});
if (this.props.onChange) {
this.props.onChange(evt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function ExampleDropContainerApp(props) {
}));
props.multiple
? setFiles([...files, ...newFiles])
: setFiles([...files, newFiles[0]]);
: setFiles([newFiles[0]]);
newFiles.forEach(uploadFile);
},
[files, props.multiple]
Expand Down

0 comments on commit 0e10c10

Please sign in to comment.