[英]How to allow touches in React Native when a ScrollView is scrolling?
Given a View in React Native that renders a ScrollView with multiple TouchableHighlight controls, how can touches on a TouchableHighlight be allowed if the user has initiated a scroll ( contents within the ScrollView are in motion )?给定 React Native 中的视图,该视图呈现具有多个 TouchableHighlight 控件的 ScrollView,如果用户已启动滚动(ScrollView 中的内容正在运动),如何允许触摸 TouchableHighlight?
Currently, the touch is handled by the ScrollView and is considered a "stop event" wherein the ScrollView stops its scrolling operation.目前,触摸由 ScrollView 处理并被视为“停止事件”,其中 ScrollView 停止其滚动操作。 Which is natural since that's a common way in which users stop a scroll in progress.
这是很自然的,因为这是用户停止滚动的常见方式。 However I'd like to be able to change this behavior and allow and/or detect the touch event while the ScrollView content is in motion.
但是,我希望能够在 ScrollView 内容处于运动状态时更改此行为并允许和/或检测触摸事件。
There is no built-in solution for that, as far as I know.据我所知,没有内置的解决方案。 You may try to set the
onMoveShouldSetResponderCapture
property on the ScrollView , that may work. 您可以尝试在 ScrollView 上设置
onMoveShouldSetResponderCapture
属性,这可能会起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.