diff --git a/packages/react-navigation/examples/NavigationPlayground/package.json b/packages/react-navigation/examples/NavigationPlayground/package.json index ed6eb206..c40c3410 100644 --- a/packages/react-navigation/examples/NavigationPlayground/package.json +++ b/packages/react-navigation/examples/NavigationPlayground/package.json @@ -39,6 +39,9 @@ "^.+\\.js$": "/node_modules/react-native/jest/preprocessor.js", "^.+\\.tsx?$": "ts-jest" }, + "transformIgnorePatterns": [ + "node_modules/(?!((jest-)?react-native|react-navigation|@react-navigation/.*))" + ], "globals": { "ts-jest": { "tsConfig": "tsconfig.jest.json" diff --git a/packages/react-navigation/examples/NavigationPlayground/tests/setup.js b/packages/react-navigation/examples/NavigationPlayground/tests/setup.js index 01b192b5..19930848 100644 --- a/packages/react-navigation/examples/NavigationPlayground/tests/setup.js +++ b/packages/react-navigation/examples/NavigationPlayground/tests/setup.js @@ -3,3 +3,44 @@ import { NativeModules } from 'react-native'; NativeModules.ReactLocalization = { language: 'en', }; + +// TODO: remove these mocks! +jest.mock('react-native-gesture-handler', () => { + const View = require('react-native/Libraries/Components/View/View'); + return { + Swipeable: View, + DrawerLayout: View, + State: {}, + ScrollView: View, + Slider: View, + Switch: View, + TextInput: View, + ToolbarAndroid: View, + ViewPagerAndroid: View, + DrawerLayoutAndroid: View, + WebView: View, + NativeViewGestureHandler: View, + TapGestureHandler: View, + FlingGestureHandler: View, + ForceTouchGestureHandler: View, + LongPressGestureHandler: View, + PanGestureHandler: View, + PinchGestureHandler: View, + RotationGestureHandler: View, + /* Buttons */ + RawButton: View, + BaseButton: View, + RectButton: View, + BorderlessButton: View, + /* Other */ + FlatList: View, + gestureHandlerRootHOC: jest.fn(), + Directions: {}, + }; +}); + +jest.mock('react-native-gesture-handler/DrawerLayout', () => { + return { + Directions: null, + }; +});