@gorhom/react-native-bottom-sheet 不适用于 Android
@gorhom/react-native-bottom-sheet doesn't work on Android
我一直在使用该库为我的 React 本机应用程序创建底部 sheet 模态,但它似乎不适用于 Android,但在 iOS 上做。我使用了文档中建议的相同背景组件和句柄组件,包含的所有内容都是提供者和 SafeAreaView
我的 package.json 包括
"@gorhom/bottom-sheet": "^3.6.5",
"react-native-reanimated": "^2.0.0",
代码结构如下:
<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>
我为 react-native-reanimated 包括插件使用了 babel 的正确配置,但它出现了,然后我无法拖动关闭。
我知道现在回答你有点晚了,但我想为其他人补充一下。假设您已经安装了 react-native-gesture-handler
,您还应该向 MainActivity.java.
添加一些代码行
我一直在使用该库为我的 React 本机应用程序创建底部 sheet 模态,但它似乎不适用于 Android,但在 iOS 上做。我使用了文档中建议的相同背景组件和句柄组件,包含的所有内容都是提供者和 SafeAreaView 我的 package.json 包括
"@gorhom/bottom-sheet": "^3.6.5",
"react-native-reanimated": "^2.0.0",
代码结构如下:
<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>
我为 react-native-reanimated 包括插件使用了 babel 的正确配置,但它出现了,然后我无法拖动关闭。
我知道现在回答你有点晚了,但我想为其他人补充一下。假设您已经安装了 react-native-gesture-handler
,您还应该向 MainActivity.java.