我一直在使用该库为我的 React Native 应用程序创建底部表单模式,但它似乎不适用于 Android,但在 iOS 上却可以。我使用了文档中建议的相同背景组件和句柄组件,并且包含的所有内容都是提供程序,并且 SafeAreaView 我的 package.json 包括
"@gorhom/bottom-sheet": "^3.6.5",
"react-native-reanimated": "^2.0.0",
Run Code Online (Sandbox Code Playgroud)
代码结构如下:
<BottomSheetModal ref={reference_settings}
index = {1}
enableOverDrag={true}
onChange = {(index) => { if(index === 0) { reference_settings.current.dismiss(); } }}
snapPoints = {[-1, '50%', '70%']}
backdropComponent={Backdrop}
handleComponent ={(props) => (<Belt {...props} />)}
style ={styles.sheet}
>
<BottomSheetView style={[styles.content]}>
<View style={{ width, height: '100%', overflow: 'hidden', backgroundColor: scheme === 'dark' ? '#000' : '#FFF', paddingHorizontal: 10 }}>
// the functions inside
</View>
</BottomSheetView>
</BottomSheetModal>
Run Code Online (Sandbox Code Playgroud)
我对 babel 使用了正确的配置来进行react-native-reanimated(包括插件),但它显示出来,然后我无法拖动关闭。
android ios react-native react-native-reanimated react-native-reanimated-v2