首页 > 解决方案 > React Native:通过向下滑动关闭模态后屏幕冻结问题

问题描述

我在 React Native 中遇到问题,我有一个屏幕,其中有一个待办事项列表和搜索栏,单击任何待办事项它会打开一个模式,其中有关闭按钮和内容。

通过按关闭按钮关闭模式时,它工作正常,但是,当我向下滑动时,我的屏幕冻结了,我无法滚动和选项卡上的待办事项列表项也无法按搜索栏输入。

此外,在向下滑动弹出窗口正在关闭但它没有触发onRequestCloseonDismiss

反应本机版本

"react": "16.8.6",
"react-native": "0.60.5",

模态代码

creditCardsModalVisibleHandler = (visible) => {
    this.setState({creditCardsModalVisible: visible});
}

<Modal
    animationType="slide"
    transparent={false}
    visible={creditCardsModalVisible}
    presentationStyle="formSheet"
    onDismiss={() => {
        console.log('Close handled');
        this.creditCardsModalSwipeHandler();
    }}
    onRequestClose={() => {
        console.log('Modal has been closed');
        this.creditCardsModalSwipeHandler();
    }}
>
    <View style={[modal.main]}>
        <TouchableOpacity onPress={() => {this.creditCardsModalVisibleHandler(!creditCardsModalVisible);}}>
            <View style={[modal.closeButton]}>
                <ImageBackground source={modal.closeBackgroundImage} style={[modal.closeButtonImage]}/>
            </View>
        </TouchableOpacity>
    </View>
</Modal>

标签: reactjsreact-native

解决方案


推荐阅读