From 078e386024474edc9b464f6c0fd8a1429e922289 Mon Sep 17 00:00:00 2001 From: Eddie Dugan Date: Fri, 12 Jun 2020 13:00:14 -0700 Subject: [PATCH] fix setNativeSelectedPosition native command Summary: telling native that `selected` is the new selection is basically ignoring the most recent user input and resetting it back to the previous value. the reason it flips back and forth is that by the next time `onSelect` is called, the above code has updated the value of `selected` (line 63) Changelog: [Android] [Fixed] Picker - fix usage of setNativeSelectedPosition in onSelect Reviewed By: mdvacca Differential Revision: D22022456 fbshipit-source-id: fe51f9cbd712b5578e9fd9ea2992bd12d48f4ec4 --- 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 573618f6c0de3e..ccefd18833d214 100644 --- a/Libraries/Components/Picker/PickerAndroid.android.js +++ b/Libraries/Components/Picker/PickerAndroid.android.js @@ -100,7 +100,7 @@ function PickerAndroid(props: Props): React.Node { props.mode === 'dropdown' ? AndroidDropdownPickerCommands : AndroidDialogPickerCommands; - Commands.setNativeSelectedPosition(current, selected); + Commands.setNativeSelectedPosition(current, position); } }, [