How to allow touches in React Native when a Scroll

2019-07-26 20:19发布

问题:

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 )?

Currently, the touch is handled by the ScrollView and is considered a "stop event" wherein the ScrollView stops its scrolling operation. 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.

回答1:

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.