Skip to content

Commit

Permalink
feat(file-uploader): add support for onChange (#4906)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack authored Dec 18, 2019
1 parent f861232 commit 66abfcf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/react/src/components/FileUploader/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ export default class FileUploader extends Component {
*/
name: PropTypes.string,

/**
* Provide an optional `onChange` hook that is called each time the input is
* changed
*/
onChange: PropTypes.func,

/**
* Provide an optional `onClick` hook that is called each time the button is
* clicked
Expand Down Expand Up @@ -347,7 +353,9 @@ export default class FileUploader extends Component {
Array.prototype.map.call(evt.target.files, file => file.name)
),
});
this.props.onChange(evt);
if (this.props.onChange) {
this.props.onChange(evt);
}
};

handleClick = (evt, index) => {
Expand Down

0 comments on commit 66abfcf

Please sign in to comment.