From a7233e45a42f333f85174e29931f65f0100e78be Mon Sep 17 00:00:00 2001 From: Lucy Beatriz Gomez Date: Wed, 20 Nov 2019 20:12:58 -0800 Subject: [PATCH] Fixing RN Picker Summary: Changelog: [Internal] Fixing a red screen on the RN picker. Looks like the picker gets confused when for unknown reasons a native value is undefined. In that case we stick to the JS value as it is specified in the comment. https://fb.workplace.com/groups/rn.support/permalink/2997783536936908/ NOTE : Native fix was landed, this add an extra layer on the JS side Reviewed By: mmmulani Differential Revision: D18443005 fbshipit-source-id: 9511ac90f2d9e6186c6c0de3b673cc535cdb9fa6 --- Libraries/Components/Picker/PickerIOS.ios.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/Picker/PickerIOS.ios.js b/Libraries/Components/Picker/PickerIOS.ios.js index 5fae9067ad7..93c0e1d0389 100644 --- a/Libraries/Components/Picker/PickerIOS.ios.js +++ b/Libraries/Components/Picker/PickerIOS.ios.js @@ -115,7 +115,11 @@ class PickerIOS extends React.Component { // This is necessary in case native updates the picker and JS decides // that the update should be ignored and we should stick with the value // that we have in JS. - if (this._picker && this._lastNativeValue !== this.state.selectedIndex) { + if ( + this._picker && + this._lastNativeValue !== undefined && + this._lastNativeValue !== this.state.selectedIndex + ) { PickerCommands.setNativeSelectedIndex( this._picker, this.state.selectedIndex,