gpt4 book ai didi

react-native - 如何在 React-Native 中停止触摸事件传播

转载 作者:行者123 更新时间:2023-12-03 14:45:47 26 4
gpt4 key购买 nike

当我长按图像时,我有一个带有图像网格的 ScrollView ,我想停止将鼠标事件传播到 ScrollView 并仅监视移动。意图在按下时重新初始化传播。有谁知道怎么做?

最佳答案

你应该看看 Gesture Responder 的方法:https://facebook.github.io/react-native/docs/gesture-responder-system.html#responder-lifecycle .实际上,更简单的方法是查看 PanResponder https://facebook.github.io/react-native/docs/panresponder.html - 首先查看 UIExplorer 示例以查看它的运行情况:https://github.com/facebook/react-native/blob/master/Examples/UIExplorer/ResponderExample.js .我不确定这是否能处理你的长按案例?

关于react-native - 如何在 React-Native 中停止触摸事件传播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31866671/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com