Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 065e5f8

Browse files
sibeliusbcarroll22
authored andcommitted
chore(navigation): upgrade to latest react-navigation v4 (#90)
1 parent 1820077 commit 065e5f8

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

examples/__tests__/react-navigation.js

+41-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import '@testing-library/jest-native/extend-expect';
22
import React from 'react';
33
import { Button, Text, View } from 'react-native';
4-
import { createStackNavigator, createAppContainer, withNavigation } from 'react-navigation';
4+
import { createAppContainer, withNavigation } from 'react-navigation';
5+
import { createStackNavigator } from 'react-navigation-stack';
56

67
import { render, fireEvent } from '../../src';
78

@@ -15,6 +16,45 @@ jest
1516
BaseButton: View,
1617
Directions: {},
1718
};
19+
})
20+
.mock('react-native-reanimated', () => {
21+
const View = require('react-native').View;
22+
23+
const Easing = {
24+
linear: jest.fn(),
25+
ease: jest.fn(),
26+
quad: jest.fn(),
27+
cubic: jest.fn(),
28+
poly: jest.fn(),
29+
sin: jest.fn(),
30+
circle: jest.fn(),
31+
exp: jest.fn(),
32+
elastic: jest.fn(),
33+
back: jest.fn(),
34+
bounce: jest.fn(),
35+
bezier: jest.fn(),
36+
in: jest.fn(),
37+
out: jest.fn(),
38+
inOut: jest.fn(),
39+
};
40+
41+
return {
42+
Easing,
43+
Value: jest.fn(),
44+
event: jest.fn(),
45+
add: jest.fn(),
46+
eq: jest.fn(),
47+
set: jest.fn(),
48+
cond: jest.fn(),
49+
interpolate: jest.fn(),
50+
View: View,
51+
Extrapolate: { CLAMP: jest.fn() },
52+
Transition: {
53+
Together: 'Together',
54+
Out: 'Out',
55+
In: 'In',
56+
},
57+
};
1858
});
1959

2060
const Home = ({ navigation }) => (

jest-preset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const jestPreset = require('react-native/jest-preset');
33
module.exports = Object.assign(jestPreset, {
44
transformIgnorePatterns: [
55
...jestPreset.transformIgnorePatterns,
6-
'node_modules/(?!(react-native.*|@?react-navigation.*)/)',
6+
'node_modules/(?!(react-native.*|@?react-navigation.*|@?react-native-community.*)/)',
77
],
88
snapshotSerializers: [require.resolve('./dist/preset/serializer.js')],
99
setupFiles: [...jestPreset.setupFiles, require.resolve('./dist/preset/setup.js')],

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,19 @@
5555
"jest-fetch-mock": "^2.1.1",
5656
"jest-in-case": "^1.0.2",
5757
"metro-react-native-babel-preset": "^0.52.0",
58+
"react-native-safe-area-context": "0.6.1",
59+
"@react-native-community/masked-view": "0.1.5",
5860
"prettier": "^1.16.4",
61+
"react-native-reanimated": "1.4.0",
5962
"pretty-quick": "^1.10.0",
6063
"react": "16.9.0",
6164
"react-hooks-testing-library": "^0.5.0",
6265
"react-intl": "^2.8.0",
6366
"react-intl-native": "^2.1.2",
6467
"react-native": "^0.61.1",
6568
"react-native-gesture-handler": "^1.1.0",
66-
"react-navigation": "^3.5.1",
69+
"react-navigation": "4.0.10",
70+
"react-navigation-stack": "2.0.0-alpha.38",
6771
"react-redux": "^7.0.3",
6872
"react-test-renderer": "16.9.0",
6973
"redux": "^4.0.1",

0 commit comments

Comments
 (0)