Skip to content

[Android] Make detector aware of child transform#4251

Open
m-bert wants to merge 3 commits into
mainfrom
@mbert/fix-swipeable-android
Open

[Android] Make detector aware of child transform#4251
m-bert wants to merge 3 commits into
mainfrom
@mbert/fix-swipeable-android

Conversation

@m-bert

@m-bert m-bert commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Description

Since 3.0 the v3 GestureDetector is a host component whose native frame is the bounding box of its children's layout frames. ReanimatedSwipeable only moves the row via transform: translateX, which doesn't affect layout. In GestureHandlerOrchestrator, the BOX_NONE branch force-records a detector's own handlers even when no child is hit, so a press on a revealed button was tracked by tap-to-close, which then activated first and cancelled the button.

This PR makes the force-record path transform-aware: for a single-child detector, handler bounds are now checked in the child's (transformed) coordinate space instead of the detector's own frame. With an identity transform the child fills the detector, so the behavior — and hitSlop expansion (#4049) — is unchanged; with a translated child the interactive area follows the content, so it no longer steals presses over revealed siblings.

Fixes #4250

Test plan

Tested on expo-example (Reanimated Swipeable, Transformations, etc.)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts Android touch-handler extraction for v3 GestureDetector so a native detector with a single transformed child (e.g. translateX in ReanimatedSwipeable) doesn’t incorrectly record/activate its own handlers over areas where its content has moved away, addressing #4250 while preserving the hitSlop behavior from #4049.

Changes:

  • Extends recordViewHandlersForPointer to optionally bounds-check handlers in a detector’s single child coordinate space.
  • Updates the BOX_NONE traversal path to use the child-space bounds check only for RNGestureHandlerDetectorView when no child handled the touch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m-bert m-bert requested a review from j-piasecki June 10, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants