Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Wait for the value to have changed in the input (#4844)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotchac authored and jacogr committed Mar 10, 2017
1 parent 8edee76 commit d98b7aa
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions js/src/ui/Form/Input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export default class Input extends Component {

onChange = (event, value) => {
event.persist();

this.setValue(value, () => {
this.props.onChange && this.props.onChange(event, value);
});
Expand All @@ -231,12 +232,10 @@ export default class Input extends Component {
}

onPaste = (event) => {
const { value } = event.target;
const pasted = event.clipboardData.getData('Text');

// Wait for the onChange handler to be called
window.setTimeout(() => {
this.onSubmit(value + pasted);
}, 0);
this.onSubmit(this.state.value);
}, 200);
}

onKeyDown = (event) => {
Expand Down

0 comments on commit d98b7aa

Please sign in to comment.