From ebf1ff6099f1a8107f5e733d654a248189828750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Wed, 26 Aug 2026 13:07:01 +0200 Subject: [PATCH] Add Reanimated mock --- .../src/__tests__/Errors.test.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx b/packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx index 10d09ca584..c783172496 100644 --- a/packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx +++ b/packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx @@ -15,6 +15,28 @@ jest.mock('react-native-worklets', () => require('react-native-worklets/src/mock') ); +// Reanimated 4.6.0 throws on import under Jest (`setCSSEventHandler` is not +// available in JSReanimated), which reanimatedWrapper silently turns into +// `Reanimated = undefined`. Mock the wrapper so gestures with worklet +// callbacks still take the Reanimated detector path these tests rely on. +// +// TODO: Remove after fixed in Reanimated +jest.mock('../handlers/gestures/reanimatedWrapper', () => ({ + Reanimated: { + useHandler: jest.fn(() => ({ + doDependenciesDiffer: false, + context: { lastUpdateEvent: undefined }, + })), + useEvent: jest.fn(() => jest.fn()), + useComposedEventHandler: jest.fn(() => jest.fn()), + isSharedValue: (value: unknown): boolean => + value !== null && typeof value === 'object' && 'value' in value, + useSharedValue: (value: T) => ({ value }), + setGestureState: jest.fn(), + }, + Worklets: undefined, +})); + beforeEach(() => cleanup()); jest.mock('react-native/Libraries/ReactNative/RendererProxy', () => ({ findNodeHandle: jest.fn(),