Commit c415c99
[Web] Don't call
## Description
On web, it was possible for a handler to get canceled twice: once by
some internal condition, and once by `pointercancel` event. The first
time was handled correctly, since the orchestrator tracked the gesture,
and it was reset correctly after being canceled. The second time, the
gesture was untracked after being reset and it was canceled "in the
void" and it was kept in the canceled state until it was registered
again, which allowed it to be cleaned properly.
It's easy to reproduce with a `Touchable` inside a `ScrollView` and
starting to scroll near the very edge of the touchable. The first cancel
happens when the pointer moves out of the touchable before the scroll
starts, and the second one is caused by the scroll starting.
This PR changes the behavior so that handlers need to be registered in
the orchestrator before being canceled.
## Test plan
|Before|After|
|-|-|
|<video
src="https://github.com/user-attachments/assets/5534bcd7-f160-4c6c-9fc9-53643364ca95"
/>|<video
src="https://github.com/user-attachments/assets/31a6a53c-dfa3-427b-bc8e-0e74f99ff2f9"
/>|
---------
Co-authored-by: Copilot <copilot@github.com>cancel on unregistered handlers (#4134)1 parent 9c6f72c commit c415c99
2 files changed
Lines changed: 8 additions & 2 deletions
File tree
- packages/react-native-gesture-handler/src/web
- handlers
- tools
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
266 | 270 | | |
267 | 271 | | |
268 | 272 | | |
269 | | - | |
| 273 | + | |
270 | 274 | | |
271 | 275 | | |
272 | 276 | | |
| |||
0 commit comments