Skip to content

Commit 7abc3f1

Browse files
committed
update test project to react-native 0.69 (#172)
# Why the react-native project for test project is outdated and there're many vulnerable alarms from dependencies. # How 1. mv test test2 2. npx react-native init test --version 0.69 3. change jsc-android maven path in `android/build.gradle` 4. use jsc-android-intl in `android/app/build.gradle` 5. add androidTestImplementation dependencies in `android/app/build.gradle` 6. cp -R test2/android/app/src/androidTest test/android/app/src/androidTest 7. update `SimpleTest.java` for the matching text 8. [ci] use java 11 # Test Plan ci passed (cherry picked from commit 32c2dbb)
1 parent 2742e43 commit 7abc3f1

Some content is hidden

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

57 files changed

+6091
-5149
lines changed

.github/workflows/build_and_test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v1
1515

16+
- name: 🔨 Use JDK 11
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: 'temurin'
20+
java-version: '11'
21+
1622
- name: Install packages
1723
run: |
1824
apt-get update
@@ -63,6 +69,12 @@ jobs:
6369
steps:
6470
- uses: actions/checkout@v1
6571

72+
- name: 🔨 Use JDK 11
73+
uses: actions/setup-java@v3
74+
with:
75+
distribution: 'temurin'
76+
java-version: '11'
77+
6678
- uses: actions/download-artifact@v2
6779
with:
6880
name: archive

test/.flowconfig

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,41 @@
88
; Ignore polyfills
99
node_modules/react-native/Libraries/polyfills/.*
1010

11-
; These should not be required directly
12-
; require from fbjs/lib instead: require('fbjs/lib/warning')
13-
node_modules/warning/.*
14-
1511
; Flow doesn't support platforms
1612
.*/Libraries/Utilities/LoadingView.js
1713

14+
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
15+
1816
[untyped]
1917
.*/node_modules/@react-native-community/cli/.*/.*
2018

2119
[include]
2220

2321
[libs]
24-
node_modules/react-native/Libraries/react-native/react-native-interface.js
22+
node_modules/react-native/interface.js
2523
node_modules/react-native/flow/
2624

2725
[options]
2826
emoji=true
2927

30-
esproposal.optional_chaining=enable
31-
esproposal.nullish_coalescing=enable
28+
exact_by_default=true
29+
30+
format.bracket_spacing=false
3231

3332
module.file_ext=.js
3433
module.file_ext=.json
3534
module.file_ext=.ios.js
3635

3736
munge_underscores=true
3837

39-
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
4038
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'
39+
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'
4240

4341
suppress_type=$FlowIssue
4442
suppress_type=$FlowFixMe
4543
suppress_type=$FlowFixMeProps
4644
suppress_type=$FlowFixMeState
4745

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]+
50-
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
51-
5246
[lints]
5347
sketchy-null-number=warn
5448
sketchy-null-mixed=warn
@@ -57,10 +51,7 @@ untyped-type-import=warn
5751
nonstrict-import=warn
5852
deprecated-type=warn
5953
unsafe-getters-setters=warn
60-
inexact-spread=warn
6154
unnecessary-invariant=warn
62-
signature-verification-failure=warn
63-
deprecated-utility=error
6455

6556
[strict]
6657
deprecated-type
@@ -72,4 +63,4 @@ untyped-import
7263
untyped-type-import
7364

7465
[version]
75-
^0.105.0
66+
^0.176.3

test/.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23+
ios/.xcode.env.local
2324

2425
# Android/IntelliJ
2526
#
@@ -28,6 +29,7 @@ build/
2829
.gradle
2930
local.properties
3031
*.iml
32+
*.hprof
3133

3234
# node.js
3335
#
@@ -48,12 +50,14 @@ buck-out/
4850
# For more information about the recommended setup visit:
4951
# https://docs.fastlane.tools/best-practices/source-control/
5052

51-
*/fastlane/report.xml
52-
*/fastlane/Preview.html
53-
*/fastlane/screenshots
53+
**/fastlane/report.xml
54+
**/fastlane/Preview.html
55+
**/fastlane/screenshots
56+
**/fastlane/test_output
5457

5558
# Bundle artifact
5659
*.jsbundle
5760

58-
# CocoaPods
61+
# Ruby / CocoaPods
5962
/ios/Pods/
63+
/vendor/bundle/

test/.prettierrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
24
bracketSpacing: false,
3-
jsxBracketSameLine: true,
45
singleQuote: true,
56
trailingComma: 'all',
67
};

test/App.js

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

99
import React from 'react';
10+
import type {Node} from 'react';
1011
import {
1112
SafeAreaView,
12-
StyleSheet,
1313
ScrollView,
14-
View,
15-
Text,
1614
StatusBar,
15+
StyleSheet,
16+
Text,
17+
useColorScheme,
18+
View,
1719
} from 'react-native';
1820

1921
import {
20-
Header,
21-
LearnMoreLinks,
2222
Colors,
2323
DebugInstructions,
24+
Header,
25+
LearnMoreLinks,
2426
ReloadInstructions,
2527
} from 'react-native/Libraries/NewAppScreen';
2628

27-
const App: () => React$Node = () => {
29+
const Section = ({children, title}): Node => {
30+
const isDarkMode = useColorScheme() === 'dark';
2831
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-
</>
32+
<View style={styles.sectionContainer}>
33+
<Text
34+
style={[
35+
styles.sectionTitle,
36+
{
37+
color: isDarkMode ? Colors.white : Colors.black,
38+
},
39+
]}>
40+
{title}
41+
</Text>
42+
<Text
43+
style={[
44+
styles.sectionDescription,
45+
{
46+
color: isDarkMode ? Colors.light : Colors.dark,
47+
},
48+
]}>
49+
{children}
50+
</Text>
51+
</View>
52+
);
53+
};
54+
55+
const App: () => Node = () => {
56+
const isDarkMode = useColorScheme() === 'dark';
57+
58+
const backgroundStyle = {
59+
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
60+
};
61+
62+
return (
63+
<SafeAreaView style={backgroundStyle}>
64+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
65+
<ScrollView
66+
contentInsetAdjustmentBehavior="automatic"
67+
style={backgroundStyle}>
68+
<Header />
69+
<View
70+
style={{
71+
backgroundColor: isDarkMode ? Colors.black : Colors.white,
72+
}}>
73+
<Section title="Step One">
74+
Edit <Text style={styles.highlight}>App.js</Text> to change this
75+
screen and then come back to see your edits.
76+
</Section>
77+
<Section title="See Your Changes">
78+
<ReloadInstructions />
79+
</Section>
80+
<Section title="Debug">
81+
<DebugInstructions />
82+
</Section>
83+
<Section title="Learn More">
84+
Read the docs to discover what to do next:
85+
</Section>
86+
<LearnMoreLinks />
87+
</View>
88+
</ScrollView>
89+
</SafeAreaView>
7290
);
7391
};
7492

7593
const styles = StyleSheet.create({
76-
scrollView: {
77-
backgroundColor: Colors.lighter,
78-
},
79-
engine: {
80-
position: 'absolute',
81-
right: 0,
82-
},
83-
body: {
84-
backgroundColor: Colors.white,
85-
},
8694
sectionContainer: {
8795
marginTop: 32,
8896
paddingHorizontal: 24,
8997
},
9098
sectionTitle: {
9199
fontSize: 24,
92100
fontWeight: '600',
93-
color: Colors.black,
94101
},
95102
sectionDescription: {
96103
marginTop: 8,
97104
fontSize: 18,
98105
fontWeight: '400',
99-
color: Colors.dark,
100106
},
101107
highlight: {
102108
fontWeight: '700',
103109
},
104-
footer: {
105-
color: Colors.dark,
106-
fontSize: 12,
107-
fontWeight: '600',
108-
padding: 4,
109-
paddingRight: 12,
110-
textAlign: 'right',
111-
},
112110
});
113111

114112
export default App;

test/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '2.7.5'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

test/_bundle/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

test/_ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.5
File renamed without changes.

0 commit comments

Comments
 (0)