Skip to content
Browse files

call onValueChange only when value changes (#24653)

`OnValueChange` function of `Picker` is called when Picker is initialized.

[Android][fixed] - `OnValueChange` will be called only when the `selectedValue` changes.
Pull Request resolved: #24653

Differential Revision: D15146483

Pulled By: cpojer

fbshipit-source-id: e26f5aa4caa673015c50c853f00b99572e803755
  • Loading branch information...
a-c-sreedhar-reddy authored and facebook-github-bot committed Apr 30, 2019
1 parent 2ef56c0 commit 82148da6672e613f34ffb48133cdefc235418dea
Showing with 3 additions and 1 deletion.
  1. +3 −1 Libraries/Components/Picker/
@@ -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);

0 comments on commit 82148da

Please sign in to comment.
You can’t perform that action at this time.