[英]React Native Modal background doesn't work properly
Im using react-native-modal我使用react-native-modal
This was my modal这是我的模态
import Modal from 'react-native-modal';
..
....
..
<Modal
visible={modalVisible} //this one was the issue (should be isVisible)
animationType={'slide'}
swipeDirection="down"
transparent={true}
onRequestClose={() => closeModal()}
onSwipeComplete={() => closeModal()}
style={{justifyContent: 'flex-end', margin: 0}}
>
</Modal>
So as you can see, my idea was to open it half way and slide it down to close正如你所看到的,我的想法是将它打开一半然后向下滑动关闭
My problem was that it was acting weird, the modal wasn't updating properly, sometimes the modal opened way less than it was supposed to我的问题是它表现得很奇怪,模态没有正确更新,有时模态的打开方式比预期的要少
After reading the documentation and common problems:阅读文档和常见问题后:
The solution was to change the visible prop to isVisible解决方案是将可见道具更改为 isVisible
isVisible={modalVisible}
We can use the npm package to show the bottom sheet in the app.我们可以使用 npm 包来显示应用程序的底部工作表。
Have a try with the below npm package.试试下面的 npm 包。
https://www.npmjs.com/package/react-native-raw-bottom-sheet https://www.npmjs.com/package/react-native-raw-bottom-sheet
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.