Allow GestureHandlerRootView
to be manually made active
#2401
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR allows users to override whether a particular
GestureHandlerRootView
is enabled or not. By default, only the topmost root view would be active, allowing all gestures to interact with each other.The problem with that approach is that if any of the native views underneath called
requestDisallowInterceptTouchEvent
, all gestures would be canceled. It comes from the fact thatrequestDisallowInterceptTouchEvent
calls are propagated up the view hierarchy and we expectGestureHandlerRootView
to be relatively close to the top.The simple solution would be to add another root view underneath the view that may call
requestDisallowInterceptTouchEvent
to prevent gestures from being canceled, this, however, resulted in two problems:I've fixed the second problem by adding checks at the beginning of
extractGestureHandlers
andtraverseWithPointerEvents
to ensure that we're not extracting gestures attached under another enabled root view.This allows for solving the problem described in #2383.
Test plan
Tested on the reproduction from #2383