Skip to content

feat: support react-native-gesture-handler v3 - #26

Merged
pawicao merged 4 commits into
mainfrom
worktree-rngh-v3-support
Oct 21, 2026
Merged

pawicao merged 4 commits into
mainfrom
worktree-rngh-v3-support

Conversation

@pawicao

@pawicao pawicao commented Aug 14, 2026 •

Copy link
Copy Markdown
Owner

Purpose

This change adds support for react-native-gesture-handler v3. 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 v3 GestureDetector sends a gesture from the v2 API to its legacy detector.

Changes

  • The peer range is now ^2.0.0 || ^3.0.0.
  • The library and the example app use Gesture Handler 3.2.1 for development.
  • A new gesture-handler-compat CI job runs yarn typecheck and yarn test against the latest v2 and the latest v3.
  • A new test, 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 transforms react-native-gesture-handler and loads its jestSetup.js.
  • The 2.x docs show the new peer range. The FAQ has a short note about v2 and v3 support. The 1.x docs do not change.

Known limits

  • With v3, GestureDetector throws in Jest when no GestureHandlerRootView wraps it. This is v3 behaviour, and the library does not change it.
  • v3 marks the Gesture builder 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 in docs/.

Open item

No test runs v3 on a device. Please run the example app and pan a pannable header. Run pod install first, because the example app changes the Gesture Handler major.

pawicao and others added 4 commits October 21, 2026 16:35
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
pawicao force-pushed the worktree-rngh-v3-support branch from 42fce01 to ea216e7 Compare October 21, 2026 14:39
@pawicao
pawicao merged commit cbc4463 into main Oct 21, 2026
6 of 7 checks passed
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.

1 participant