Repository navigation
Commit 5eaf877
authored
## Description
On web, `PanGestureHandler.updateGestureConfig` writes
`enableTrackpadTwoFingerGesture`, but `resetConfig` never restores it.
`setGestureConfig` is a full config replace (`resetConfig` then
`updateGestureConfig`), and it is what `updateHandlers` / `useGesture`
call whenever the gesture config changes. So once a pan gesture has been
configured with `enableTrackpadTwoFingerGesture: true`, a later config
that no longer carries the prop keeps two-finger trackpad panning
enabled, and a wheel event from a trackpad still activates the gesture.
Every other field the web `PanGestureHandler` reads from the config is
restored in `resetConfig`; this one was missed. iOS is already correct:
`RNPanHandler`'s `resetConfig` sets `recognizer.allowedScrollTypesMask =
0`, which is the same property. Android does not support the prop, so
this is web only.
## Test plan
Added `src/web/handlers/__tests__/PanGestureHandler.test.ts` with two
cases:
- configure the handler with `enableTrackpadTwoFingerGesture: true`,
then apply a config without it, and feed a touchpad wheel event: the
handler must stay `UNDETERMINED`.
- configure it with `enableTrackpadTwoFingerGesture: true` and feed the
same event: the handler must reach `ACTIVE`, so the flag itself keeps
working.
Without the one-line change in `resetConfig`, the first test fails with
`Expected: 0 / Received: 4` (the gesture activates from stale config).
The second one passes both ways.
`yarn test`, `yarn lint-js` and `yarn ts-check` are green in
`packages/react-native-gesture-handler`.
1 parent 2efd514 commit 5eaf877
2 files changed
Lines changed: 100 additions & 0 deletions
File tree
- packages/react-native-gesture-handler/src/web/handlers
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments