React Navigation V6 Modal带有scrollview内部 - 当Top Scrollview到达时向下滑动模式

发布于 2025-02-11 20:31:02 字数 1504 浏览 1 评论 0原文

我对React-Navigation V6的模态表达有问题,以呈现带有卷轴的模态。 实际上,如果我可以手势向下滑动模态,那么如果里面有卷轴浏览,它就不起作用,并且我只能在标头上滑动。

我需要在达到Scrollview顶部时,必须开始删除动画手势。 这是预期的行为:

“在此处输入图像描述”

这是rootNavigation内部使用的代码:

<RootStack.Group screenOptions={{ presentation: 'modal', cardOverlayEnabled: true, ...TransitionPresets.ModalPresentationIOS }}>
    <RootStack.Screen
       component={ModalPage}
       name="ModalPage"
       options={ModalPageNavOptions}
    />
</RootStack.Group> 

这是 modalpage.js

<ScrollView nestedScrollEnabled>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
</ScrollView>

ps的渲染:我正在使用Expo

I have a problem with the modal-presentation of react-navigation v6 to present a modal with ScrollView inside of it.
Actually if I enable gesture to swipe down the modal, it doesn't work if there is a ScrollView inside and I can swipe down only on the header.

I need that when reaching the ScrollView's top, must start dismiss animation gesture.
This is the expected behavior:

enter image description here

This is the code used inside the RootNavigation:

<RootStack.Group screenOptions={{ presentation: 'modal', cardOverlayEnabled: true, ...TransitionPresets.ModalPresentationIOS }}>
    <RootStack.Screen
       component={ModalPage}
       name="ModalPage"
       options={ModalPageNavOptions}
    />
</RootStack.Group> 

This is render of ModalPage.js

<ScrollView nestedScrollEnabled>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
  <Text>TEST TEXT</Text>
</ScrollView>

PS: I'm using expo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不必你懂 2025-02-18 20:31:03

对于iOS,可以使用本机stack navigator 具有相同的代码您已经提供了。

如果您仍然只想仅使用堆栈导航器,则在这里来自其他人的解决方案,但我不能确定他们运行良好。

For iOS, this behavior is possible to achieve with Native Stack Navigator with the same code you've provided.

If you still want to use just the Stack Navigator then here are some solutions from other people but I can't say for sure that they work well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文