[英]React Native Picker select: are there any callbacks available for Android?
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()
.我在我的 React Native 应用程序中使用react-native-picker-select ,我为 iOS 使用的两个主要回调是onClose()
和onDonePress()
。 However, these are iOS only.但是,这些只是 iOS。 Is there some approach you can use with Android to trigger a function when the user has closed the picker or pressed Done
?当用户关闭选择器或按下Done
时,有什么方法可以与 Android 一起使用来触发 function 吗? 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.我知道您可以使用onValueChange()
,但这不会在用户完成时触发,只是在他们遍历选择器中的选项时触发。
onClose is iOS only, I was able to get a similar behavior for Android using onBlur of touchableWrapperProps (please make sure to add fixAndroidTouchableBug). onClose 仅为 iOS,我能够使用 touchableWrapperProps 的 onBlur 为 Android 获得类似的行为(请确保添加 fixAndroidTouchableBug)。
const handleOnClose = () => {};
<RNPickerSelect
onClose={handleOnClose} // iOS only
fixAndroidTouchableBug
touchableWrapperProps={{ onBlur: handleOnClose }} // Android only
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.