I'm using react-native-picker-select in my React Native app, and the two main callbacks I'm using for iOS are onClose()
and onDonePress()
. However, these are iOS only. Is there some approach you can use with Android to trigger a function when the user has closed the picker or pressed Done
? I know you can use onValueChange()
, but this doesn't get triggered when the user is done, just when they iterate through the options in the picker.
Asked
Active
Viewed 383 times
1

gkeenley
- 6,088
- 8
- 54
- 129
-
It look android didn't need to touch the "done" button, it doesn't have that button, didn't it? – 高鵬翔 May 07 '20 at 08:26
1 Answers
1
onClose is iOS only, I was able to get a similar behavior for Android using onBlur of touchableWrapperProps (please make sure to add fixAndroidTouchableBug).
const handleOnClose = () => {};
<RNPickerSelect
onClose={handleOnClose} // iOS only
fixAndroidTouchableBug
touchableWrapperProps={{ onBlur: handleOnClose }} // Android only
/>

Manuel Gonzalez
- 11
- 2