Skip to content

Commit ff4c4d5

Browse files
committed
Upgrade test project to RN 0.61
1 parent bbabd3b commit ff4c4d5

Some content is hidden

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

49 files changed

+5808
-2305
lines changed

test/.babelrc

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

test/.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+
};

test/.flowconfig

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,71 @@
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]
2524
node_modules/react-native/Libraries/react-native/react-native-interface.js
2625
node_modules/react-native/flow/
27-
node_modules/react-native/flow-github/
2826

2927
[options]
3028
emoji=true
3129

3230
esproposal.optional_chaining=enable
3331
esproposal.nullish_coalescing=enable
3432

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

5037
munge_underscores=true
5138

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

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

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

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

test/.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/

test/.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+
};

test/App.js

Lines changed: 100 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,109 @@
66
* @flow
77
*/
88

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

12-
const instructions = Platform.select({
13-
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
14-
android:
15-
'Double tap R on your keyboard to reload,\n' +
16-
'Shake or press menu button for dev menu',
17-
});
19+
import {
20+
Header,
21+
LearnMoreLinks,
22+
Colors,
23+
DebugInstructions,
24+
ReloadInstructions,
25+
} from 'react-native/Libraries/NewAppScreen';
1826

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

3275
const styles = StyleSheet.create({
33-
container: {
34-
flex: 1,
35-
justifyContent: 'center',
36-
alignItems: 'center',
37-
backgroundColor: '#F5FCFF',
38-
},
39-
welcome: {
40-
fontSize: 20,
41-
textAlign: 'center',
42-
margin: 10,
43-
},
44-
instructions: {
45-
textAlign: 'center',
46-
color: '#333333',
47-
marginBottom: 5,
76+
scrollView: {
77+
backgroundColor: Colors.lighter,
78+
},
79+
engine: {
80+
position: 'absolute',
81+
right: 0,
82+
},
83+
body: {
84+
backgroundColor: Colors.white,
85+
},
86+
sectionContainer: {
87+
marginTop: 32,
88+
paddingHorizontal: 24,
89+
},
90+
sectionTitle: {
91+
fontSize: 24,
92+
fontWeight: '600',
93+
color: Colors.black,
94+
},
95+
sectionDescription: {
96+
marginTop: 8,
97+
fontSize: 18,
98+
fontWeight: '400',
99+
color: Colors.dark,
100+
},
101+
highlight: {
102+
fontWeight: '700',
103+
},
104+
footer: {
105+
color: Colors.dark,
106+
fontSize: 12,
107+
fontWeight: '600',
108+
padding: 4,
109+
paddingRight: 12,
110+
textAlign: 'right',
48111
},
49112
});
113+
114+
export default App;

test/__tests__/App-test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

test/android/app/BUCK

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@
88
# - `buck install -r android/app` - compile, install and run application
99
#
1010

11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
1113
lib_deps = []
1214

13-
for jarfile in glob(['libs/*.jar']):
14-
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15-
lib_deps.append(':' + name)
16-
prebuilt_jar(
17-
name = name,
18-
binary_jar = jarfile,
19-
)
15+
create_aar_targets(glob(["libs/*.aar"]))
2016

21-
for aarfile in glob(['libs/*.aar']):
22-
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23-
lib_deps.append(':' + name)
24-
android_prebuilt_aar(
25-
name = name,
26-
aar = aarfile,
27-
)
17+
create_jar_targets(glob(["libs/*.jar"]))
2818

2919
android_library(
3020
name = "all-libs",

0 commit comments

Comments
 (0)