Skip to content

Commit

Permalink
Fixed #1842 - InputNumber's onValueChange is called unconditionally w…
Browse files Browse the repository at this point in the history
…hen the onBlur event occurs.
  • Loading branch information
mertsincan committed May 5, 2021
1 parent e5bf9ad commit 84ee189
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,13 @@ export class InputNumber extends Component {
onInputBlur(event) {
event.persist();
this.setState({ focused: false }, () => {
let newValue = this.validateValue(this.parseValue(this.inputRef.current.value));
this.updateInputValue(newValue);
this.updateModel(event, newValue);
let currentValue = this.inputRef.current.value;

if (this.isValueChanged(currentValue, this.props.value)) {
let newValue = this.validateValue(this.parseValue(currentValue));
this.updateInputValue(newValue);
this.updateModel(event, newValue);
}

if (this.props.onBlur) {
this.props.onBlur(event);
Expand Down

0 comments on commit 84ee189

Please sign in to comment.