Skip to content

[Web] Align Tap maxDelay default with native (200 ms) - #4557

Open
Shexter wants to merge 3 commits into
software-mansion:mainfrom
Shexter:fix-web-tap-max-delay-default
Open

Shexter wants to merge 3 commits into
software-mansion:mainfrom
Shexter:fix-web-tap-max-delay-default

Conversation

@Shexter

@Shexter Shexter commented Oct 1, 2026 •

Copy link
Copy Markdown

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.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 19:59
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 5e438c24-674d-46a1-9f3e-6390f3411417

📥 Commits

Reviewing files that changed from the base of the PR and between 97e50ec and b75a6a6.

📒 Files selected for processing (1)
  • packages/react-native-gesture-handler/src/handlers/gestures/tapGesture.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Behavior Changes
    • The default maximum delay between successive taps is now 200 ms, down from 500 ms.
  • Documentation
    • Tap gesture documentation now reflects the 200 ms default.

Walkthrough

The web tap handler’s default inter-tap delay changes from 500 ms to 200 ms. Related tap gesture documentation now states a 200 ms default.

Changes

Tap Gesture Delay

Layer / File(s) Summary
Update tap delay default and documentation
packages/react-native-gesture-handler/src/web/handlers/TapGestureHandler.ts, packages/docs-gesture-handler/docs/gestures/use-tap-gesture.mdx, packages/react-native-gesture-handler/src/handlers/TapGestureHandler.ts, packages/react-native-gesture-handler/src/v3/hooks/gestures/tap/TapTypes.ts, packages/react-native-gesture-handler/src/handlers/gestures/tapGesture.ts
The web handler’s default inter-tap delay changes to 200 ms. Related documentation states a 200 ms default. The other handler implementations are unchanged.

Suggested reviewers: m-bert

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b75a6

Web multi-taps now use a 200 ms default interval instead of 500 ms; callers needing a longer interval can configure it explicitly. The related documentation matches this intended change, so no actionable merge risk remains.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 64871

The change shortens the default waiting period without expanding access or authority. Explicit timeout settings remain effective, and the existing failure and cleanup paths are preserved. No material security risk was identified in the changed behavior.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure change is limited to the timing of local web multi-tap recognition for callers using the default. The scoped runtime change introduces no new event source, configuration field, or privileged operation.

Trust Boundaries and Controls

  • inferred — Pointer input still reaches the existing gesture transition methods. The shorter delay invokes the same failure and cleanup path rather than bypassing a boundary or gaining additional callback authority.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: aligning the web Tap gesture's default maxDelay with the native 200 ms default.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused change includes regression coverage, preserves explicit overrides, and has no identified blocking issues.

Review effort: Balanced
Findings: None

What changed in this PR

Aligns web Tap’s default inter-tap delay with Android and Apple at 200 ms, while preserving explicit overrides.

Changes:

  • Changes the web default from 500 ms to 200 ms.
  • Adds regression tests for timing, overrides, and configuration resets.
  • Updates current documentation and API comments; versioned docs remain unchanged.
File Description
packages/​react-native-gesture-handler/​src/​web/​handlers/​TapGestureHandler.ts Sets the default delay to 200 ms.
packages/​react-native-gesture-handler/​src/​web/​handlers/​__tests__/​TapGestureHandler.test.ts Tests default timing, overrides, and resets.
packages/​react-native-gesture-handler/​src/​v3/​hooks/​gestures/​tap/​TapTypes.ts Corrects the v3 default-value comment.
packages/​react-native-gesture-handler/​src/​handlers/​TapGestureHandler.ts Corrects the legacy API default-value comment.
packages/​docs-gesture-handler/​docs/​gestures/​use-tap-gesture.mdx Documents the 200 ms default.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@m-bert m-bert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR! ❤️

I don't think the test file is necessary, other than that looks good!

@m-bert m-bert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! ❤️

@Shexter

Shexter commented Oct 2, 2026

Copy link
Copy Markdown
Author

Thanks for reviewing the PR! 🙏❤️ You're right, changing one constant doesn't need a whole new test file, so I removed it. I also updated one more stale "default is 500" comment in the v2 builder (tapGesture.ts) that I had missed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants