Skip to content

Commit 21fa92f

Browse files
authored
Updated example to rn 0.62.2 (#122)
- Updated example to react-native 0.62.2 with autolinking - Tested with version 0.0.14.
1 parent a088b5c commit 21fa92f

38 files changed

+2940
-2586
lines changed

Example/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

Example/.flowconfig

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,23 @@
55
; Ignore "BUCK" generated dirs
66
<PROJECT_ROOT>/\.buckd/
77

8-
; Ignore unexpected extra "@providesModule"
9-
.*/node_modules/.*/node_modules/fbjs/.*
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
1010

11-
; Ignore duplicate module providers
12-
; For RN Apps installed via npm, "Libraries" folder is inside
13-
; "node_modules/react-native" but in the source repo it is in the root
14-
.*/Libraries/react-native/React.js
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
1514

16-
; Ignore polyfills
17-
.*/Libraries/polyfills/.*
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
1817

19-
; Ignore metro
20-
.*/node_modules/metro/.*
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
2120

2221
[include]
2322

2423
[libs]
25-
node_modules/react-native/Libraries/react-native/react-native-interface.js
24+
node_modules/react-native/interface.js
2625
node_modules/react-native/flow/
2726

2827
[options]
@@ -31,39 +30,45 @@ emoji=true
3130
esproposal.optional_chaining=enable
3231
esproposal.nullish_coalescing=enable
3332

34-
module.system=haste
35-
module.system.haste.use_name_reducers=true
36-
# get basename
37-
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
38-
# strip .js or .js.flow suffix
39-
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
40-
# strip .ios suffix
41-
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
42-
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
43-
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
44-
module.system.haste.paths.blacklist=.*/__tests__/.*
45-
module.system.haste.paths.blacklist=.*/__mocks__/.*
46-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
47-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
4836

4937
munge_underscores=true
5038

51-
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\)$' -> 'RelativeImageStub'
52-
53-
module.file_ext=.js
54-
module.file_ext=.jsx
55-
module.file_ext=.json
56-
module.file_ext=.native.js
39+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
40+
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'
5741

5842
suppress_type=$FlowIssue
5943
suppress_type=$FlowFixMe
6044
suppress_type=$FlowFixMeProps
6145
suppress_type=$FlowFixMeState
6246

63-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
64-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
65-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
47+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
6649
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
6750

51+
[lints]
52+
sketchy-null-number=warn
53+
sketchy-null-mixed=warn
54+
sketchy-number=warn
55+
untyped-type-import=warn
56+
nonstrict-import=warn
57+
deprecated-type=warn
58+
unsafe-getters-setters=warn
59+
inexact-spread=warn
60+
unnecessary-invariant=warn
61+
signature-verification-failure=warn
62+
deprecated-utility=error
63+
64+
[strict]
65+
deprecated-type
66+
nonstrict-import
67+
sketchy-null
68+
unclear-type
69+
unsafe-getters-setters
70+
untyped-import
71+
untyped-type-import
72+
6873
[version]
69-
^0.92.0
74+
^0.113.0

Example/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23-
project.xcworkspace
2423

2524
# Android/IntelliJ
2625
#
@@ -40,6 +39,7 @@ yarn-error.log
4039
buck-out/
4140
\.buckd/
4241
*.keystore
42+
!debug.keystore
4343

4444
# fastlane
4545
#
@@ -54,3 +54,6 @@ buck-out/
5454

5555
# Bundle artifact
5656
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/

Example/.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};

Example/App.js

Lines changed: 112 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,133 @@
33
* https://github.com/facebook/react-native
44
*
55
* @format
6-
* @flow
6+
* @flow strict-local
77
*/
88

9-
import React, {Component} from 'react';
10-
import {Platform, StyleSheet, Text, View, TouchableOpacity} from 'react-native';
9+
import React from 'react';
10+
import {
11+
SafeAreaView,
12+
StyleSheet,
13+
ScrollView,
14+
View,
15+
Text,
16+
StatusBar,
17+
TouchableOpacity
18+
} from 'react-native';
1119

12-
import RNRestart from 'react-native-restart';
20+
import {
21+
Header,
22+
LearnMoreLinks,
23+
Colors,
24+
DebugInstructions,
25+
ReloadInstructions,
26+
} from 'react-native/Libraries/NewAppScreen';
1327

14-
const instructions = Platform.select({
15-
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
16-
android:
17-
'Double tap R on your keyboard to reload,\n' +
18-
'Shake or press menu button for dev menu',
19-
});
28+
import RNRestart from 'react-native-restart';
2029

21-
type Props = {};
22-
export default class App extends Component<Props> {
23-
render() {
24-
return (
25-
<View style={styles.container}>
26-
<Text style={styles.welcome}>Welcome to React Native!</Text>
27-
<Text style={styles.instructions}>To get started, edit App.js</Text>
28-
<Text style={styles.instructions}>{instructions}</Text>
29-
<Text style={styles.instructions}>
30-
To restart the app, press on this button:
31-
</Text>
32-
<TouchableOpacity onPress={() => RNRestart.Restart()}>
33-
<View style={styles.restartButton}>
34-
<Text style={{color: '#fff'}}>Restart</Text>
30+
const App: () => React$Node = () => {
31+
return (
32+
<>
33+
<StatusBar barStyle="dark-content" />
34+
<SafeAreaView>
35+
<ScrollView
36+
contentInsetAdjustmentBehavior="automatic"
37+
style={styles.scrollView}>
38+
<Header />
39+
{global.HermesInternal == null ? null : (
40+
<View style={styles.engine}>
41+
<Text style={styles.footer}>Engine: Hermes</Text>
42+
</View>
43+
)}
44+
<View style={styles.body}>
45+
<View style={styles.sectionContainer}>
46+
<Text style={styles.sectionTitle}>Step One</Text>
47+
<Text style={styles.sectionDescription}>
48+
To restart the app, press on this button:
49+
</Text>
50+
<TouchableOpacity onPress={() => RNRestart.Restart()}>
51+
<View style={styles.restartButton}>
52+
<Text style={{color: '#000'}}>Restart</Text>
53+
</View>
54+
</TouchableOpacity>
55+
</View>
56+
<View style={styles.sectionContainer}>
57+
<Text style={styles.sectionTitle}>Step One</Text>
58+
<Text style={styles.sectionDescription}>
59+
Edit <Text style={styles.highlight}>App.js</Text> to change this
60+
screen and then come back to see your edits.
61+
</Text>
62+
</View>
63+
<View style={styles.sectionContainer}>
64+
<Text style={styles.sectionTitle}>See Your Changes</Text>
65+
<Text style={styles.sectionDescription}>
66+
<ReloadInstructions />
67+
</Text>
68+
</View>
69+
<View style={styles.sectionContainer}>
70+
<Text style={styles.sectionTitle}>Debug</Text>
71+
<Text style={styles.sectionDescription}>
72+
<DebugInstructions />
73+
</Text>
74+
</View>
75+
<View style={styles.sectionContainer}>
76+
<Text style={styles.sectionTitle}>Learn More</Text>
77+
<Text style={styles.sectionDescription}>
78+
Read the docs to discover what to do next:
79+
</Text>
80+
</View>
81+
<LearnMoreLinks />
3582
</View>
36-
</TouchableOpacity>
37-
</View>
38-
);
39-
}
40-
}
83+
</ScrollView>
84+
</SafeAreaView>
85+
</>
86+
);
87+
};
4188

4289
const styles = StyleSheet.create({
43-
container: {
44-
flex: 1,
45-
justifyContent: 'center',
46-
alignItems: 'center',
47-
backgroundColor: '#F5FCFF',
90+
scrollView: {
91+
backgroundColor: Colors.lighter,
92+
},
93+
engine: {
94+
position: 'absolute',
95+
right: 0,
96+
},
97+
body: {
98+
backgroundColor: Colors.white,
4899
},
49-
welcome: {
50-
fontSize: 20,
51-
textAlign: 'center',
52-
margin: 10,
100+
sectionContainer: {
101+
marginTop: 32,
102+
paddingHorizontal: 24,
53103
},
54-
instructions: {
55-
textAlign: 'center',
56-
color: '#333333',
57-
marginBottom: 5,
104+
sectionTitle: {
105+
fontSize: 24,
106+
fontWeight: '600',
107+
color: Colors.black,
108+
},
109+
sectionDescription: {
110+
marginTop: 8,
111+
fontSize: 18,
112+
fontWeight: '400',
113+
color: Colors.dark,
114+
},
115+
highlight: {
116+
fontWeight: '700',
58117
},
59118
restartButton: {
60119
backgroundColor: '#7d7d7d',
61120
paddingHorizontal: 50,
62121
paddingVertical: 20,
63122
marginTop: 10,
64123
borderRadius: 10
65-
}
124+
},
125+
footer: {
126+
color: Colors.dark,
127+
fontSize: 12,
128+
fontWeight: '600',
129+
padding: 4,
130+
paddingRight: 12,
131+
textAlign: 'right',
132+
},
66133
});
134+
135+
export default App;

0 commit comments

Comments
 (0)