Skip to content

Commit b3bfc33

Browse files
authored
chore: bump to [email protected] in examples (#8884)
1 parent 47b8aae commit b3bfc33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+667
-2569
lines changed

babel.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
module.exports = {
99
babelrcRoots: ['examples/*'],
10+
// we don't wanna run the transforms in this file over react native
11+
exclude: /react-native/,
1012
overrides: [
1113
{
1214
plugins: [

examples/react-native/.babelrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
22

33
module.exports = {
4-
presets: ['@babel/preset-env', 'module:metro-react-native-babel-preset'],
4+
presets: ['module:metro-react-native-babel-preset'],
55
};

examples/react-native/.flowconfig

Lines changed: 0 additions & 41 deletions
This file was deleted.

examples/react-native/Intro.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/**
44
* Sample React Native App
55
* https://github.com/facebook/react-native
6-
* @flow
76
*/
87

98
import React, {Component} from 'react';
@@ -28,7 +27,7 @@ const styles = StyleSheet.create({
2827
},
2928
});
3029

31-
export default class Intro extends Component<{}> {
30+
export default class Intro extends Component {
3231
render() {
3332
return (
3433
<View style={styles.container}>

examples/react-native/__tests__/__snapshots__/intro.test.js.snap

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,67 @@ exports[`renders the ActivityIndicator component 1`] = `
4545
/>
4646
`;
4747

48+
exports[`renders the FlatList component 1`] = `
49+
<RCTScrollView
50+
data={
51+
Array [
52+
"apple",
53+
"banana",
54+
"kiwi",
55+
]
56+
}
57+
disableVirtualization={false}
58+
getItem={[Function]}
59+
getItemCount={[Function]}
60+
horizontal={false}
61+
initialNumToRender={10}
62+
keyExtractor={[Function]}
63+
maxToRenderPerBatch={10}
64+
numColumns={1}
65+
onContentSizeChange={[Function]}
66+
onEndReachedThreshold={2}
67+
onLayout={[Function]}
68+
onMomentumScrollEnd={[Function]}
69+
onScroll={[Function]}
70+
onScrollBeginDrag={[Function]}
71+
onScrollEndDrag={[Function]}
72+
removeClippedSubviews={false}
73+
renderItem={[Function]}
74+
scrollEventThrottle={50}
75+
stickyHeaderIndices={Array []}
76+
updateCellsBatchingPeriod={50}
77+
viewabilityConfigCallbackPairs={Array []}
78+
windowSize={21}
79+
>
80+
<View>
81+
<View
82+
onLayout={[Function]}
83+
style={null}
84+
>
85+
<Text>
86+
apple
87+
</Text>
88+
</View>
89+
<View
90+
onLayout={[Function]}
91+
style={null}
92+
>
93+
<Text>
94+
banana
95+
</Text>
96+
</View>
97+
<View
98+
onLayout={[Function]}
99+
style={null}
100+
>
101+
<Text>
102+
kiwi
103+
</Text>
104+
</View>
105+
</View>
106+
</RCTScrollView>
107+
`;
108+
48109
exports[`renders the Image component 1`] = `
49110
<Image
50111
style={
@@ -56,34 +117,11 @@ exports[`renders the Image component 1`] = `
56117
/>
57118
`;
58119

59-
exports[`renders the ListView component 1`] = `
60-
<RCTScrollView
61-
dataSource={
62-
ListViewDataSource {
63-
"items": 3,
64-
}
65-
}
66-
renderRow={[Function]}
67-
renderScrollComponent={[Function]}
68-
>
69-
<View>
70-
<Text>
71-
apple
72-
</Text>
73-
<Text>
74-
banana
75-
</Text>
76-
<Text>
77-
kiwi
78-
</Text>
79-
</View>
80-
</RCTScrollView>
81-
`;
82-
83120
exports[`renders the TextInput component 1`] = `
84121
<TextInput
85122
allowFontScaling={true}
86123
autoCorrect={false}
124+
rejectResponderTermination={true}
87125
underlineColorAndroid="transparent"
88126
value="apple banana kiwi"
89127
/>

examples/react-native/__tests__/intro.test.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
* Sample React Native Snapshot Test
55
*/
66

7-
'use strict';
8-
9-
import 'react-native';
107
import React from 'react';
11-
import Intro from '../Intro';
12-
13-
// Note: test renderer must be required after react-native.
8+
import {
9+
ActivityIndicator,
10+
FlatList,
11+
Image,
12+
Text,
13+
TextInput,
14+
} from 'react-native';
1415
import renderer from 'react-test-renderer';
16+
import Intro from '../Intro';
1517

1618
jest.setTimeout(15000);
1719

@@ -22,15 +24,13 @@ it('renders correctly', () => {
2224

2325
// These serve as integration tests for the jest-react-native preset.
2426
it('renders the ActivityIndicator component', () => {
25-
const ActivityIndicator = require('ActivityIndicator');
2627
const tree = renderer
2728
.create(<ActivityIndicator animating={true} size="small" />)
2829
.toJSON();
2930
expect(tree).toMatchSnapshot();
3031
});
3132

3233
it('renders the Image component', done => {
33-
const Image = require('Image');
3434
Image.getSize('path.jpg', (width, height) => {
3535
const tree = renderer.create(<Image style={{height, width}} />).toJSON();
3636
expect(tree).toMatchSnapshot();
@@ -39,24 +39,19 @@ it('renders the Image component', done => {
3939
});
4040

4141
it('renders the TextInput component', () => {
42-
const TextInput = require('TextInput');
4342
const tree = renderer
4443
.create(<TextInput autoCorrect={false} value="apple banana kiwi" />)
4544
.toJSON();
4645
expect(tree).toMatchSnapshot();
4746
});
4847

49-
it('renders the ListView component', () => {
50-
const ListView = require('ListView');
51-
const Text = require('Text');
52-
const dataSource = new ListView.DataSource({
53-
rowHasChanged: (r1, r2) => r1 !== r2,
54-
}).cloneWithRows(['apple', 'banana', 'kiwi']);
48+
it('renders the FlatList component', () => {
5549
const tree = renderer
5650
.create(
57-
<ListView
58-
dataSource={dataSource}
59-
renderRow={rowData => <Text>{rowData}</Text>}
51+
<FlatList
52+
data={['apple', 'banana', 'kiwi']}
53+
keyExtractor={item => item}
54+
renderItem={({item}) => <Text>{item}</Text>}
6055
/>
6156
)
6257
.toJSON();

examples/react-native/android/app/BUCK

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)