From 0edc7e1fda513842a2b867c0c38039dd8a40e923 Mon Sep 17 00:00:00 2001 From: A C SREEDHAR REDDY Date: Mon, 29 Apr 2019 23:06:15 +0530 Subject: [PATCH 1/2] call onValueChange only when value changes --- Libraries/Components/Picker/PickerAndroid.android.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/Picker/PickerAndroid.android.js b/Libraries/Components/Picker/PickerAndroid.android.js index 9dcc8cc10b7ca6..84a4b0f2da122d 100644 --- a/Libraries/Components/Picker/PickerAndroid.android.js +++ b/Libraries/Components/Picker/PickerAndroid.android.js @@ -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); } From aab5bb106226342d6f05df3f8f122aa0a62e6617 Mon Sep 17 00:00:00 2001 From: A C SREEDHAR REDDY Date: Mon, 29 Apr 2019 23:13:30 +0530 Subject: [PATCH 2/2] lint fix --- Libraries/Components/Picker/PickerAndroid.android.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Components/Picker/PickerAndroid.android.js b/Libraries/Components/Picker/PickerAndroid.android.js index 84a4b0f2da122d..6e82f8c7e94681 100644 --- a/Libraries/Components/Picker/PickerAndroid.android.js +++ b/Libraries/Components/Picker/PickerAndroid.android.js @@ -119,7 +119,7 @@ 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. */ - if (this.props.selectedValue !== value){ + if (this.props.selectedValue !== value) { this.props.onValueChange(value, position); } } else {