/* eslint-env jest */ // react-native-gesture-handler and react-native-reanimated both depend on // native modules that are not present in the Jest environment. Mock the // TurboModuleRegistry calls so importing our screens does not throw. jest.mock('react-native-gesture-handler', () => { const View = require('react-native').View; const React = require('react'); const passthrough = component => React.forwardRef((props, ref) => { const Comp = component; return React.createElement(Comp, { ...props, ref }); }); return { __esModule: true, GestureHandlerRootView: passthrough(View), GestureDetector: passthrough(View), Gesture: { Pan: () => ({ onBegin: () => ({ onUpdate: () => ({ onEnd: () => ({ onFinalize: () => ({ minDistance: () => ({}) }), }), }), }), }), Pinch: () => ({ onBegin: () => ({ onUpdate: () => ({ onEnd: () => ({ onFinalize: () => ({}) }), }), }), }), Tap: () => ({ maxDuration: () => ({ onEnd: () => ({}) }) }), Race: (...args) => ({ _args: args }), Simultaneous: (...args) => ({ _args: args }), }, }; }); jest.mock('react-native-reanimated', () => { const View = require('react-native').View; return { __esModule: true, default: { View, createAnimatedComponent: c => c, Value: function () {} }, runOnJS: fn => fn, useSharedValue: initial => ({ value: initial }), useAnimatedStyle: () => ({}), withTiming: v => v, withSpring: v => v, Easing: { inOut: () => ({}), linear: () => ({}) }, }; });