[Android] Fix Intercepting and Virtual detectors hit testing#4095
Merged
Conversation
PR #3981 changed the condition from `view is RNGestureHandlerDetectorView` to `hostDetectorView != null`, which incorrectly caused Virtual and Intercepting detector handlers to enter the detector-child coordinate transform branch. These handlers have their events in the virtual child's coordinate space, not the detector's. Adding `view == detectorView` restores correct behavior while preserving the multi-child iteration logic.
Copilot created this pull request from a session on behalf of
m-bert
April 16, 2026 09:54
View session
Intercepting and Virtual detectors hit testing
m-bert
approved these changes
Apr 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refines Android hit-testing in GestureHandler.handle() so the detector-child coordinate transform only runs when the handler is attached directly to the RNGestureHandlerDetectorView, fixing incorrect x/y and bounds checks for virtual (and related) detector-attached handlers.
Changes:
- Tightens the multi-child detector hit-test condition by requiring
view == detectorView. - Prevents applying an extra (incorrect) detector→child coordinate transform for handlers whose events are already in the child’s coordinate space.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
j-piasecki
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR #3981 changed the hit-test condition in
GestureHandler.handle()fromview is RNGestureHandlerDetectorViewtohostDetectorView != null, which is too broad —hostDetectorViewis set for all handler types (regular, native, virtual, intercepting), but the detector-child coordinate transform should only run when the handler'sviewis the detector itself.For Virtual/Intercepting handlers, the event is already in the virtual child's coordinate space. Entering the detector branch applies a bogus transform, breaking
x/yandisWithinBounds.Fix
Added
view == detectorViewto the condition so the multi-child hit test only runs when the handler is bound directly to the detector view: