Skip to content

Commit d8fd154

Browse files
authored
chore: bump RN to 0.62 (#273)
* chore: bump RN to 0.62 * disable accessibilityStates tests; fixups
1 parent 0ecf788 commit d8fd154

File tree

7 files changed

+357
-424
lines changed

7 files changed

+357
-424
lines changed

.flowconfig

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ node_modules/warning/.*
2121
[include]
2222

2323
[libs]
24-
node_modules/react-native/Libraries/react-native/react-native-interface.js
24+
node_modules/react-native/interface.js
2525
node_modules/react-native/flow/
2626
flow-typed
2727

@@ -38,9 +38,8 @@ module.file_ext=.ios.js
3838

3939
munge_underscores=true
4040

41-
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
4241
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
43-
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
42+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
4443

4544
suppress_type=$FlowIssue
4645
suppress_type=$FlowFixMe

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
"@babel/core": "^7.8.7",
2020
"@callstack/eslint-config": "^9.1.0",
2121
"@release-it/conventional-changelog": "^1.1.0",
22-
"@types/react": "^16.9.23",
23-
"@types/react-native": "^0.61.23",
22+
"@types/react": "^16.9.34",
23+
"@types/react-native": "^0.62.2",
2424
"@types/react-test-renderer": "^16.9.2",
2525
"babel-jest": "^25.1.0",
2626
"conventional-changelog-cli": "^2.0.11",
2727
"dedent": "^0.7.0",
2828
"eslint": "^6.8.0",
29-
"flow-bin": "^0.107.0",
29+
"flow-bin": "^0.116.0",
3030
"flow-copy-source": "^2.0.6",
3131
"jest": "^25.1.0",
3232
"metro-react-native-babel-preset": "^0.58.0",
3333
"react": "^16.13.0",
34-
"react-native": "^0.61.5",
34+
"react-native": "^0.62.2",
3535
"react-test-renderer": "^16.13.0",
3636
"release-it": "^12.3.3",
3737
"strip-ansi": "^5.2.0",

src/__tests__/__snapshots__/debug.test.js.snap

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`debug 1`] = `
4-
"<TouchableOpacity
5-
activeOpacity={0.2}
4+
"<ForwardRef
65
onPress={[Function _callee]}
76
>
87
<TextComponent
98
text=\\"Press me 0\\"
109
/>
11-
</TouchableOpacity>"
10+
</ForwardRef>"
1211
`;
1312

1413
exports[`debug.deep 1`] = `
1514
"<View
1615
accessible={true}
1716
focusable={true}
18-
isTVSelectable={true}
19-
onClick={[Function bound touchableHandlePress]}
20-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
21-
onResponderMove={[Function bound touchableHandleResponderMove]}
22-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
23-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
24-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
25-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
17+
onClick={[Function onClick]}
18+
onResponderGrant={[Function onResponderGrant]}
19+
onResponderMove={[Function onResponderMove]}
20+
onResponderRelease={[Function onResponderRelease]}
21+
onResponderTerminate={[Function onResponderTerminate]}
22+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
23+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
2624
style={
2725
Object {
2826
\\"opacity\\": 1,
@@ -39,14 +37,13 @@ exports[`debug.deep async test 1`] = `
3937
"<View
4038
accessible={true}
4139
focusable={true}
42-
isTVSelectable={true}
43-
onClick={[Function bound touchableHandlePress]}
44-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
45-
onResponderMove={[Function bound touchableHandleResponderMove]}
46-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
47-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
48-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
49-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
40+
onClick={[Function onClick]}
41+
onResponderGrant={[Function onResponderGrant]}
42+
onResponderMove={[Function onResponderMove]}
43+
onResponderRelease={[Function onResponderRelease]}
44+
onResponderTerminate={[Function onResponderTerminate]}
45+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
46+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
5047
style={
5148
Object {
5249
\\"opacity\\": 1,

src/__tests__/__snapshots__/render.test.js.snap

+25-29
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ exports[`debug 1`] = `
2929
<View
3030
accessible={true}
3131
focusable={true}
32-
isTVSelectable={true}
33-
onClick={[Function bound touchableHandlePress]}
34-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
35-
onResponderMove={[Function bound touchableHandleResponderMove]}
36-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
37-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
38-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
39-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
32+
onClick={[Function onClick]}
33+
onResponderGrant={[Function onResponderGrant]}
34+
onResponderMove={[Function onResponderMove]}
35+
onResponderRelease={[Function onResponderRelease]}
36+
onResponderTerminate={[Function onResponderTerminate]}
37+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
38+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
4039
style={
4140
Object {
4241
\\"opacity\\": 1,
@@ -92,14 +91,13 @@ exports[`debug changing component: bananaFresh button message should now be "fre
9291
<View
9392
accessible={true}
9493
focusable={true}
95-
isTVSelectable={true}
96-
onClick={[Function bound touchableHandlePress]}
97-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
98-
onResponderMove={[Function bound touchableHandleResponderMove]}
99-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
100-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
101-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
102-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
94+
onClick={[Function onClick]}
95+
onResponderGrant={[Function onResponderGrant]}
96+
onResponderMove={[Function onResponderMove]}
97+
onResponderRelease={[Function onResponderRelease]}
98+
onResponderTerminate={[Function onResponderTerminate]}
99+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
100+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
103101
style={
104102
Object {
105103
\\"opacity\\": 1,
@@ -136,15 +134,15 @@ exports[`debug: shallow 1`] = `
136134
>
137135
not fresh
138136
</Text>
139-
<TextInput
137+
<Component
140138
allowFontScaling={true}
141139
placeholder=\\"Add custom freshness\\"
142140
rejectResponderTermination={true}
143141
testID=\\"bananaCustomFreshness\\"
144142
underlineColorAndroid=\\"transparent\\"
145143
value=\\"Custom Freshie\\"
146144
/>
147-
<TextInput
145+
<Component
148146
allowFontScaling={true}
149147
placeholder=\\"Who inspected freshness?\\"
150148
rejectResponderTermination={true}
@@ -186,15 +184,15 @@ exports[`debug: shallow with message 1`] = `
186184
>
187185
not fresh
188186
</Text>
189-
<TextInput
187+
<Component
190188
allowFontScaling={true}
191189
placeholder=\\"Add custom freshness\\"
192190
rejectResponderTermination={true}
193191
testID=\\"bananaCustomFreshness\\"
194192
underlineColorAndroid=\\"transparent\\"
195193
value=\\"Custom Freshie\\"
196194
/>
197-
<TextInput
195+
<Component
198196
allowFontScaling={true}
199197
placeholder=\\"Who inspected freshness?\\"
200198
rejectResponderTermination={true}
@@ -255,14 +253,13 @@ exports[`debug: with message 1`] = `
255253
<View
256254
accessible={true}
257255
focusable={true}
258-
isTVSelectable={true}
259-
onClick={[Function bound touchableHandlePress]}
260-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
261-
onResponderMove={[Function bound touchableHandleResponderMove]}
262-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
263-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
264-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
265-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
256+
onClick={[Function onClick]}
257+
onResponderGrant={[Function onResponderGrant]}
258+
onResponderMove={[Function onResponderMove]}
259+
onResponderRelease={[Function onResponderRelease]}
260+
onResponderTerminate={[Function onResponderTerminate]}
261+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
262+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
266263
style={
267264
Object {
268265
\\"opacity\\": 1,
@@ -293,7 +290,6 @@ exports[`toJSON 1`] = `
293290
<View
294291
accessible={true}
295292
focusable={false}
296-
isTVSelectable={true}
297293
onClick={[Function]}
298294
onResponderGrant={[Function]}
299295
onResponderMove={[Function]}

src/__tests__/a11yAPI.test.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const Typography = ({ children, ...rest }: any) => {
2121
class Button extends React.Component<any> {
2222
render() {
2323
return (
24+
// $FlowFixMe - accessibilityStates removed in RN 0.62
2425
<TouchableOpacity
2526
accessibilityHint={BUTTON_HINT}
2627
accessibilityLabel={BUTTON_LABEL}
@@ -49,6 +50,7 @@ function Section() {
4950
accessibilityHint={TEXT_HINT}
5051
accessibilityLabel={TEXT_LABEL}
5152
accessibilityRole={TEXT_ROLE}
53+
// $FlowFixMe - removed in RN 0.62
5254
accessibilityStates={['selected', 'disabled']}
5355
accessibilityState={{ expanded: false }}
5456
accessibilityValue={{ max: 60 }}
@@ -130,7 +132,8 @@ test('getAllByA11yRole, queryAllByA11yRole', () => {
130132
expect(queryAllByA11yRole(NO_MATCHES_TEXT)).toEqual([]);
131133
});
132134

133-
test('getByA11yStates, queryByA11yStates', () => {
135+
// TODO: accessibilityStates was removed from RN 0.62
136+
test.skip('getByA11yStates, queryByA11yStates', () => {
134137
const { getByA11yStates, queryByA11yStates } = render(<Section />);
135138

136139
expect(getByA11yStates('disabled').props.accessibilityStates).toEqual([
@@ -155,7 +158,8 @@ test('getByA11yStates, queryByA11yStates', () => {
155158
expect(() => queryByA11yStates('selected')).toThrow(FOUND_TWO_INSTANCES);
156159
});
157160

158-
test('getAllByA11yStates, queryAllByA11yStates', () => {
161+
// TODO: accessibilityStates was removed from RN 0.62
162+
test.skip('getAllByA11yStates, queryAllByA11yStates', () => {
159163
const { getAllByA11yStates, queryAllByA11yStates } = render(<Section />);
160164

161165
expect(getAllByA11yStates('selected')).toHaveLength(3);

src/__tests__/fireEvent.test.js

+3-13
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ describe('fireEvent', () => {
5757
});
5858

5959
test('should throw an Error when event handler was not found', () => {
60-
const { getByTestId } = render(<WithoutEventComponent />);
60+
const { getByTestId } = render(
61+
<WithoutEventComponent onPress={() => 'this is not passed to children'} />
62+
);
6163

6264
expect(() => fireEvent(getByTestId('text'), 'press')).toThrow(
6365
'No handler function found for event: "press"'
@@ -78,18 +80,6 @@ describe('fireEvent', () => {
7880

7981
expect(handlerMock).toHaveBeenCalledWith(EVENT_DATA);
8082
});
81-
82-
test('should not bubble event to root element', () => {
83-
const onPressMock = jest.fn();
84-
const { getByTestId } = render(
85-
<TouchableOpacity onPress={onPressMock}>
86-
<Text testID="test">Content</Text>
87-
</TouchableOpacity>
88-
);
89-
90-
expect(() => fireEvent.press(getByTestId('test'))).toThrow();
91-
expect(onPressMock).not.toHaveBeenCalled();
92-
});
9383
});
9484

9585
test('fireEvent.press', () => {

0 commit comments

Comments
 (0)