Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Only set value if debounce when onBlur/onSubmit.
Browse files Browse the repository at this point in the history
  • Loading branch information
T4rk1n committed Dec 3, 2018
1 parent 4c1f6b2 commit ba5bb1a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Input.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ export default class Input extends Component {
setProps({
n_blur: this.props.n_blur + 1,
n_blur_timestamp: new Date(),
value: castValue,
});
if (debounce) {
setProps({value: castValue});
}
}
}}
onKeyPress={e => {
Expand All @@ -79,8 +81,10 @@ export default class Input extends Component {
setProps({
n_submit: this.props.n_submit + 1,
n_submit_timestamp: new Date(),
value: castValue,
});
if (debounce) {
setProps({value: castValue});
}
}
}}
value={value}
Expand Down

0 comments on commit ba5bb1a

Please sign in to comment.