Commit 8b43cf5
authored
[Android][iOS] Don't handle events on the detector surface (#3823)
## Description
Prevents `NativeDetector` from reacting to events that happen on its
surface but not on any of its children. This should match the behavior
from the V2 API, and feels more like an "expected" result.
This doesn't affect the web since `display: contents` there isn't
subject to our hacks and the detector doesn't create a box. The behavior
after this PR should be consistent across the platforms.
Since codegen is not perfect, to put it lightly, I had to redeclare
`pointerEvents` in the spec and handle the setter on Android. The only
base class that does it automatically is `ReactViewManager`, but we need
to create a `ViewGroup` to accept children.
## Test plan
|-|Android|iOS|
|-|-|-|
|Before|<video
src='https://github.com/user-attachments/assets/d936d480-ab94-4d6c-803a-1ea06c7b3fa0'
/>|<video
src='https://github.com/user-attachments/assets/e7bf9560-1a6e-4c66-8528-523108655ea4'
/>|
|After|<video
src='https://github.com/user-attachments/assets/cfa6aa95-2392-4d1c-a0c5-75d3c751b2b7'
/>|<video
src='https://github.com/user-attachments/assets/4f45bc6d-3699-4293-8ad1-c8b8426d28a5'
/>|1 parent 2ebe247 commit 8b43cf5
4 files changed
Lines changed: 15 additions & 0 deletions
File tree
- packages/react-native-gesture-handler
- android/src/main/java/com/swmansion/gesturehandler/react
- src
- specs
- v3/detectors
- VirtualDetector
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| |||
0 commit comments