mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
call onValueChange only when value changes (#24653)
Summary: `OnValueChange` function of `Picker` is called when Picker is initialized. [Android][fixed] - `OnValueChange` will be called only when the `selectedValue` changes. Pull Request resolved: https://github.com/facebook/react-native/pull/24653 Differential Revision: D15146483 Pulled By: cpojer fbshipit-source-id: e26f5aa4caa673015c50c853f00b99572e803755
This commit is contained in:
committed by
Facebook Github Bot
parent
2ef56c025d
commit
82148da667
@@ -119,7 +119,9 @@ class PickerAndroid extends React.Component<
|
||||
const value = children[position].props.value;
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
|
||||
* found when making Flow check .android.js files. */
|
||||
this.props.onValueChange(value, position);
|
||||
if (this.props.selectedValue !== value) {
|
||||
this.props.onValueChange(value, position);
|
||||
}
|
||||
} else {
|
||||
this.props.onValueChange(null, position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user