Repository navigation
Commit ccfb376
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.
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 f3ecd00 commit ccfb376
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
| |||
0 commit comments