From 7207532625bf127ca9c7e11da96fb9ccab03a577 Mon Sep 17 00:00:00 2001 From: bindoon Date: Sun, 29 Sep 2019 12:48:33 +0800 Subject: [PATCH] fix(NumberPicker): fix display valueunder controlled. fix #1163 --- src/number-picker/number-picker.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/number-picker/number-picker.jsx b/src/number-picker/number-picker.jsx index 1bf5a506c2..6bacc1b63b 100644 --- a/src/number-picker/number-picker.jsx +++ b/src/number-picker/number-picker.jsx @@ -266,6 +266,15 @@ class NumberPicker extends React.Component { } if (`${val}` !== `${value}`) { + // under controled, set back to props.value + if ( + 'value' in this.props && + `${this.props.value}` !== `${this.state.value}` + ) { + this.setState({ + value: this.props.value, + }); + } this.onCorrect(val, value); }