[英]How to implement drag-down-to-close a React Native Modal?
I'm trying to achieve a feature similar to Tik-Tok's Comments Feature, press a button to open up a modal containing scrollview/flatlist, and we can drag the modal to close itself.我正在尝试实现一个类似于抖音的评论功能的功能,按下一个按钮打开一个包含scrollview/flatlist的模态,我们可以拖动模态来关闭它自己。
My Goal:我的目标:
I did find anything about drag-to-close in React-Native Modal reference, please help me!我确实在 React-Native Modal 参考中找到了有关拖动关闭的任何信息,请帮助我!
Code I have now (very basic):我现在拥有的代码(非常基本):
<Modal
animationType='slide'
visible={isOpen}
transparent
>
<View style={{ height: 100, position: 'absolute', bottom: 0 }}>
<FlatList .../>
</View>
</Modal>
Great solution provided by @Jatin Bhuva 's comment above, the drag-to-close feature of a modal can be achieved with React-Native-Bottom-Sheet by @gorhom , And in addition: the package allows integrations with flatlists or scrollables inside :) @Jatin Bhuva 上面的评论提供了很好的解决方案,模态的拖拉关闭功能可以通过@gorhom 的 React-Native-Bottom-Sheet 实现,此外:package 允许与内部的平面列表或滚动条集成:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.