diff --git a/examples/__tests__/react-navigation.js b/examples/__tests__/react-navigation.js index 1be2baa..ace2ab7 100644 --- a/examples/__tests__/react-navigation.js +++ b/examples/__tests__/react-navigation.js @@ -1,7 +1,8 @@ import '@testing-library/jest-native/extend-expect'; import React from 'react'; import { Button, Text, View } from 'react-native'; -import { createStackNavigator, createAppContainer, withNavigation } from 'react-navigation'; +import { createAppContainer, withNavigation } from 'react-navigation'; +import { createStackNavigator } from 'react-navigation-stack'; import { render, fireEvent } from '../../src'; @@ -15,6 +16,45 @@ jest BaseButton: View, Directions: {}, }; + }) + .mock('react-native-reanimated', () => { + const View = require('react-native').View; + + const Easing = { + linear: jest.fn(), + ease: jest.fn(), + quad: jest.fn(), + cubic: jest.fn(), + poly: jest.fn(), + sin: jest.fn(), + circle: jest.fn(), + exp: jest.fn(), + elastic: jest.fn(), + back: jest.fn(), + bounce: jest.fn(), + bezier: jest.fn(), + in: jest.fn(), + out: jest.fn(), + inOut: jest.fn(), + }; + + return { + Easing, + Value: jest.fn(), + event: jest.fn(), + add: jest.fn(), + eq: jest.fn(), + set: jest.fn(), + cond: jest.fn(), + interpolate: jest.fn(), + View: View, + Extrapolate: { CLAMP: jest.fn() }, + Transition: { + Together: 'Together', + Out: 'Out', + In: 'In', + }, + }; }); const Home = ({ navigation }) => ( diff --git a/jest-preset.js b/jest-preset.js index 5789b3c..3d4ea40 100644 --- a/jest-preset.js +++ b/jest-preset.js @@ -3,7 +3,7 @@ const jestPreset = require('react-native/jest-preset'); module.exports = Object.assign(jestPreset, { transformIgnorePatterns: [ ...jestPreset.transformIgnorePatterns, - 'node_modules/(?!(react-native.*|@?react-navigation.*)/)', + 'node_modules/(?!(react-native.*|@?react-navigation.*|@?react-native-community.*)/)', ], snapshotSerializers: [require.resolve('./dist/preset/serializer.js')], setupFiles: [...jestPreset.setupFiles, require.resolve('./dist/preset/setup.js')], diff --git a/package.json b/package.json index 8a3e201..f61481b 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,10 @@ "jest-fetch-mock": "^2.1.1", "jest-in-case": "^1.0.2", "metro-react-native-babel-preset": "^0.52.0", + "react-native-safe-area-context": "0.6.1", + "@react-native-community/masked-view": "0.1.5", "prettier": "^1.16.4", + "react-native-reanimated": "1.4.0", "pretty-quick": "^1.10.0", "react": "16.9.0", "react-hooks-testing-library": "^0.5.0", @@ -63,7 +66,8 @@ "react-intl-native": "^2.1.2", "react-native": "^0.61.1", "react-native-gesture-handler": "^1.1.0", - "react-navigation": "^3.5.1", + "react-navigation": "4.0.10", + "react-navigation-stack": "2.0.0-alpha.38", "react-redux": "^7.0.3", "react-test-renderer": "16.9.0", "redux": "^4.0.1",