Repository navigation
Commit ab44f1e
authored
[Web] Align Tap maxDelay default with native (200 ms) (#4557)
## Description
The default for Tap's `maxDelay` (how long the handler waits for the
next tap when `numberOfTaps > 1`) was 500 ms on web but 200 ms on
Android and Apple, so the same `useTapGesture({ numberOfTaps: 2 })`
behaved differently per platform:
| Platform | Default | Location |
|---|---|---|
| Web | 500 ms | `src/web/handlers/TapGestureHandler.ts:10` |
| Android | 200 ms | `android/.../core/TapGestureHandler.kt:190` |
| Apple | 200 ms | `apple/Handlers/RNTapHandler.m:51` |
As discussed in #4555, 200 ms is the intended default, since it is the
value chosen for mobile. This PR changes web to 200 ms and updates the
places that stated 500 ms: the `useTapGesture` docs page and the
`maxDelay` comments in `TapTypes.ts`, the v1 `TapGestureHandler.ts` and
the v2 `tapGesture.ts`. The 1.x and 2.x versioned docs are untouched.
**Behaviour change:** on web, a multi-tap now fails if the next tap
takes longer than 200 ms, unless `maxDelay` is set explicitly. Setting
it keeps working as before.
Discussion: #4555
## Test plan
Ran in `packages/react-native-gesture-handler`:
- `yarn test`: 21 suites, 178 tests passed
- `yarn ts-check`: exit 0
- `yarn lint:js`: exit 0, 0 errors
I also checked the new default with a throwaway Jest test (two-tap
config, first tap, 300 ms passes), which failed at 500 and passed at
200. It is not included in the PR.
The change is web and docs only, so I did not run Android or iOS builds.1 parent bb62b06 commit ab44f1e
5 files changed
Lines changed: 5 additions & 5 deletions
File tree
- packages
- docs-gesture-handler/docs/gestures
- react-native-gesture-handler/src
- handlers
- gestures
- v3/hooks/gestures/tap
- web/handlers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments