【问题标题】:@gorhom/react-native-bottom-sheet doesn't work on Android@gorhom/react-native-bottom-sheet 不适用于 Android
【发布时间】:2021-08-13 16:15:26
【问题描述】:

我一直在使用该库为我的 react native 应用程序创建底部表单模式,但它似乎不适用于 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 配置,包括插件,但它显示出来,然后我无法拖动关闭。

【问题讨论】:

    标签: android ios react-native react-native-reanimated react-native-reanimated-v2


    【解决方案1】:

    我知道现在回答你有点晚,但我想为其他人补充。假设您已经安装了react-native-gesture-handler,您还应该在 MainActivity.java 中添加一些代码行。

    【讨论】:

    • 这就是我所缺少的!谢谢!
    猜你喜欢
    • 2022-12-18
    • 2022-06-15
    • 2022-10-18
    • 2020-03-28
    • 1970-01-01
    • 2020-03-25
    • 2017-06-08
    • 2023-01-22
    • 2022-01-11
    相关资源
    最近更新 更多