SIGN IN SIGN UP

Keep ReanimatedSwipeable native handlers stable when event callbacks change (#4466)

## Description

Fixes #3307

Passing inline `onSwipeableOpen` / `onSwipeableClose` (or the other
event props) to `ReanimatedSwipeable` made list scrolling stutter, even
when the callbacks were empty. Those functions sat in the
worklet/`useCallback` dependency chain, so a new identity on every
parent render rebuilt the pan and tap gesture configs and reconfigured
the native handlers.

This change:

- keeps the latest user callbacks behind stable wrappers
(`useEventCallback`)
- memoizes the tap/pan configs so native handlers are only updated when
gesture settings actually change
- still invokes the most recent callback after a callback-only rerender

`ReanimatedDrawerLayout` has a similar pattern, but it is typically a
single instance per screen rather than a list row, so it is left
untouched here.

## Test plan

- [x] `yarn test src/__tests__/reanimatedSwipeableCallbacks.test.tsx` —
native `setGestureHandlerConfig` is not called again when only event
callback identities change
- [x] same file — `close()` after a callback-only rerender invokes the
latest `onSwipeableWillClose`
- [x] sabotage: bypassing `useEventCallback` makes the identity test
fail (`2` → `4` `setConfig` calls)
- [x] `yarn test` — 19 suites / 158 tests pass
- [x] `yarn lint:js` (no new errors) and `yarn ts-check`
- [x] Please confirm scrolling a `FlatList`/`FlashList` of
`ReanimatedSwipeable` rows with inline `onSwipeableOpen={() => {}}` no
longer drops JS FPS
N
Ngoc Le committed
5de6d2358d22a9eda0ef3bd4fe54b14ea3d4ed9d
Parent: 6f73a7e
Committed by GitHub <noreply@github.com> on 8/24/2026, 3:04:01 PM