Skip to content

Conversation

@j-piasecki
Copy link
Member

Description

Currently handlers attached to the ancestors of a view are extracted only if the view overflows its parent as described in #1618. There is at least one more use-case where that would be a desirable behavior: if the view has pointer-events prop set to box-none then the view itself cannot become the target of touch events but its children can, however currently any gesture handler attached to that view would not be extracted when its child captures a touch event.
An example of this can be found in this issue: #1000 (note that this PR does not fully resolve this issue as there are more things to be addressed there).

Test plan

Tested on the Example app and on slightly modified code from the linked issue (imported touchables and flatlist from react-native-gesture-handler instead of react-native).

@j-piasecki j-piasecki closed this Apr 21, 2022
@j-piasecki j-piasecki deleted the extract-ancestor-handlers branch April 21, 2022 09:29
j-piasecki added a commit that referenced this pull request Jun 15, 2022
…s='box-none'` (#2024)

As described in the [docs](https://reactnative.dev/docs/view#pointerevents), when a view has `pointerEvents` prop set to `box-none` then it will never be a touch target but its children might be. Current implementation ignores gestures attached to the view with `pointerEvents='box-none'` entirely, even if its child is handling events, contrary to how it works on iOS where the gestures attached to parent will also work on the child view (but not on the parent).

This PR changes implementation of the view traversing algorithm to also extract gestures from a view with `pointerEvents='box-none'` when the target of a touch is its descendant.

Fixes #1575. Supersedes #1710.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant