-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Possible feature enhancement, to help incremental adoption in existing body-scroller React apps.
There are 2 significant issues with using Touchable*
components within an app that relies on the document.body
(rather than ScrollView
) being the root scroller. I believe the root cause of both issues is that the body is not part of the responder system, which Touchable
and ScrollView
rely on to coordinate transfer of the responder grant.
Touchable*
press events will fire under a finger that is scrolling the body
This is because the Touchable*
remains the touch responder during a body
scroll. Unlike ScrollView
, the body element is not under React's control, and is not connected to the responder system.
This can be reproduced in the storybook's documentation for Touchable{Highlight,Opacity}
.
- Start a scroll on top of a Touchable
- Release the Touchable
Actual: press events fire during the gesture.
Expected: no press events fire during the gesture.
TouchableHighlight
underlay can remain visible for a couple of seconds after the gesture
All the events fire when expected. But the visual underlay gets stuck. This problem only occurs under the following conditions: it's the first touch to occur after a body-scroll AND a ScrollView
has not been scrolled yet. (I've actually occasionally seen this happen with TouchableHighlight
within a ScrollView
, but I don't have any reliable steps to reproduce.)
This can be reproduced in the storybook's documentation for TouchableHighlight
.
- Go straight to the
TouchableHighlight
screen. - Scroll down to the examples
- Press an example
Actual: underlay remains visible long after touch finishes
Expected: underlay immediately disappears
- Without doing anything else, press again
Actual/Expected: underlay immediately disappears.
- Scroll the screen
- Press the example again
Actual: underlay remains visible long after touch finishes
Expected: underlay immediately disappears
- Repeat previous steps. The behaviour should reproduce consistently.
- Go to the
ScrollView
screen. - Find an example
ScrollView
and scroll it. - Go back to the
TouchableHighlight
screen. - Attempt to reproduce steps 3-7.
You should find that the issue has magically been resolved.
Environment (include versions). Did this work in previous versions?
- OS: all
- Device: all
- Browser: all
- React Native for Web (version): all
- React (version): all