Repository navigation
feat: support react-native-gesture-handler v3 - #26
Merged
Merged
Conversation
Widen the Gesture Handler peer range to `^2.0.0 || ^3.0.0`. No source changes were needed: every symbol this library uses is still exported from the v3 package root under the same name, and v3's `GestureDetector` accepts legacy gestures and dispatches to the legacy detector at runtime. The v3 `Legacy*` renames only touched components and gesture instance types, none of which we import. Our public type surface reaches Gesture Handler on a single line — the `GestureStateChangeEvent` / `PanGestureHandlerEventPayload` import in `types.ts` — and both are root exports in v2 and v3 with identical payload shapes. Add a `gesture-handler-compat` CI matrix over both majors. `yarn typecheck` is the step that actually enforces the range: `src/` is `.ts`, so a missing Gesture Handler export fails there even under `skipLibCheck: true`. A consumer-side type test was prototyped and dropped — in a `.d.ts` an unresolved import silently widens to the error type, which defeats every assertion, including `0 extends 1 & T` any-detection. Verified `lint`, `typecheck`, `test`, `prepare`, and the example app's typecheck against both 2.30.0 and 3.2.1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Move the pinned devDependency and the example app to 3.2.1, so local development and the example exercise the v3 code path. This matters for the example in particular: v3's `GestureDetector` routes legacy gestures to `LegacyGestureDetector` at runtime, and unit tests mock Gesture Handler entirely, so the example is the only place that branch runs for real. The `gesture-handler-compat` matrix keeps v2 covered. Its v2 leg overrides only the root devDependency, which is enough: `yarn typecheck` excludes `example` and Jest ignores `example/node_modules`, so the example's v3 pin does not leak into the v2 leg. Verified by simulating that install locally. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pawicao
force-pushed
the
worktree-rngh-v3-support
branch
from
October 21, 2026 14:39
42fce01 to
ea216e7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This change adds support for
react-native-gesture-handlerv3. The library continues to support v2. The peer range becomes^2.0.0 || ^3.0.0.The source code does not change. v3 exports all the Gesture Handler symbols that the library uses (
Gesture,GestureDetector,GestureHandlerRootView,GestureStateChangeEvent,PanGestureHandlerEventPayload) from the package root, with the same names. The v3GestureDetectorsends a gesture from the v2 API to its legacy detector.Changes
^2.0.0 || ^3.0.0.gesture-handler-compatCI job runsyarn typecheckandyarn testagainst the latest v2 and the latest v3.HeaderPanBoundary.test.tsx, uses the real Gesture Handler. It renders a pannable header, sends a pan gesture, and checks the scroll and the momentum. Jest now transformsreact-native-gesture-handlerand loads itsjestSetup.js.Known limits
GestureDetectorthrows in Jest when noGestureHandlerRootViewwraps it. This is v3 behaviour, and the library does not change it.Gesturebuilder API as deprecated. A future Gesture Handler major can remove it.Verification
I ran these commands against 2.33.1 and 3.2.1:
yarn typecheck: pass.yarn test: pass, 39 tests.yarn lint: pass, with two old warnings indocs/.Open item
No test runs v3 on a device. Please run the example app and pan a pannable header. Run
pod installfirst, because the example app changes the Gesture Handler major.