【发布时间】:2020-01-07 08:27:58
【问题描述】:
关闭 react-native 模态时是否有任何事件将其向下滑动而不使用模态内的任何按钮(onDismiss 不起作用)? 谈这个模态https://facebook.github.io/react-native/docs/modal.html
【问题讨论】:
关闭 react-native 模态时是否有任何事件将其向下滑动而不使用模态内的任何按钮(onDismiss 不起作用)? 谈这个模态https://facebook.github.io/react-native/docs/modal.html
【问题讨论】:
显然这是一个错误,可能会在下一个版本中修复。
https://github.com/facebook/react-native/issues/26892
在那之前的解决方法(使用文档中的示例):
setModalVisible = visible => {
// Assuming that the button who's calling this method is behind the modal, before clicking it, first set modal to visible false, then set the state from the button `visible` or not.
this.setState({modalVisible: false});
setTimeout(() => {
this.setState({modalVisible: visible});
});
};
【讨论】: