Repository navigation
Commit 0bbc5a3
authored
[Android] Check the overflow ancestor pass against the detector child's bounds (#4605)
## Description
Since #4532 a native detector's frame is widened to cover its
transformed child. The orchestrator already checks the detector's own
handlers against the child's transform-aware bounds when the child
didn't consume the touch (`useChildBounds`), so a translated-away child
doesn't stay tappable over the area it vacated. The overflow pass right
below that check still used the host frame. In an open
`ReanimatedSwipeable` the widened host spans the whole row, so a tap on
the action panel passed the "pointer inside the view" test,
`isViewOverflowingParent` was true and `extractAncestorHandlers`
recorded the row's pan and the list's scroll handler before the
traversal reached the panel.
`ButtonViewGroup.shouldBeginWithRecordedHandlers` then cancelled the
button's handler at record time, so `RectButton`, `Pressable` and
`Touchable` inside the panel never pressed. Whether a given open row was
affected depended on whether a layout pass had run since opening, which
is why it looked random.
The overflow pass now uses the same bounds as the handler check above
it. For every view that isn't a single-child detector host nothing
changes. For the host, a pointer over the vacated area skips the early
ancestor recording; the ancestors still get recorded in the normal order
as the traversal unwinds, since they contain the pointer themselves.
Native touch delivery from #4532 is a shadow node change and isn't
touched.
Fixes the action buttons of `ReanimatedSwipeable` rows on Android
(regression from #4532, not in 3.3.0).
## Test plan
Android emulator, `expo-example`, Reanimated Swipeable:
- Swipe a row open, press `Flag` / the Gmail row icon / `Archive`: the
row closes and the press fires. Before: nothing.
- Tap the open row's content: still closes.
- Reduced #4529 check in the empty screen: an RN `Switch` inside a
detector whose child is translated (static transform and Reanimated
slide) still toggles, and a triple tap still reaches the detector's
gesture.
`yarn lint:android` passes.1 parent dff741a commit 0bbc5a3
1 file changed
Lines changed: 6 additions & 3 deletions
File tree
- packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
665 | | - | |
666 | | - | |
667 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
668 | 671 | | |
669 | 672 | | |
670 | 673 | | |
| |||
0 commit comments