Skip to content

Commit ba26fe3

Browse files
committed
Upgrade react-native to v0.66
1 parent 49dd260 commit ba26fe3

Some content is hidden

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

51 files changed

+1836
-1795
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Windows files
2+
[*.bat]
3+
end_of_line = crlf

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
*.pbxproj -text
1+
# Windows files should use crlf line endings
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
*.bat text eol=crlf

.gitignore

Lines changed: 3 additions & 6 deletions
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
#
@@ -29,10 +28,7 @@ build/
2928
.gradle
3029
local.properties
3130
*.iml
32-
33-
# Visual Studio Code
34-
#
35-
.vscode/
31+
*.hprof
3632

3733
# node.js
3834
#
@@ -44,6 +40,7 @@ yarn-error.log
4440
buck-out/
4541
\.buckd/
4642
*.keystore
43+
!debug.keystore
4744

4845
# fastlane
4946
#
@@ -60,4 +57,4 @@ buck-out/
6057
*.jsbundle
6158

6259
# CocoaPods
63-
/ios/Pods/
60+
/ios/Pods/

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ module.exports = {
33
jsxBracketSameLine: true,
44
singleQuote: true,
55
trailingComma: 'all',
6+
arrowParens: 'avoid',
67
};

App.tsx

Lines changed: 67 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,111 +8,108 @@
88
* @format
99
*/
1010

11-
import React, {Fragment} from 'react';
11+
import React from 'react';
1212
import {
1313
SafeAreaView,
14-
StyleSheet,
1514
ScrollView,
16-
View,
17-
Text,
1815
StatusBar,
16+
StyleSheet,
17+
Text,
18+
useColorScheme,
19+
View,
1920
} from 'react-native';
2021

2122
import {
22-
Header,
23-
LearnMoreLinks,
2423
Colors,
2524
DebugInstructions,
25+
Header,
26+
LearnMoreLinks,
2627
ReloadInstructions,
2728
} from 'react-native/Libraries/NewAppScreen';
2829

30+
const Section: React.FC<{
31+
title: string;
32+
}> = ({children, title}) => {
33+
const isDarkMode = useColorScheme() === 'dark';
34+
return (
35+
<View style={styles.sectionContainer}>
36+
<Text
37+
style={[
38+
styles.sectionTitle,
39+
{
40+
color: isDarkMode ? Colors.white : Colors.black,
41+
},
42+
]}>
43+
{title}
44+
</Text>
45+
<Text
46+
style={[
47+
styles.sectionDescription,
48+
{
49+
color: isDarkMode ? Colors.light : Colors.dark,
50+
},
51+
]}>
52+
{children}
53+
</Text>
54+
</View>
55+
);
56+
};
57+
2958
const App = () => {
30-
const usingHermes = typeof HermesInternal === 'object' && HermesInternal !== null;
59+
const isDarkMode = useColorScheme() === 'dark';
60+
61+
const backgroundStyle = {
62+
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
63+
};
3164

3265
return (
33-
<Fragment>
34-
<StatusBar barStyle="dark-content" />
35-
<SafeAreaView>
36-
<ScrollView
37-
contentInsetAdjustmentBehavior="automatic"
38-
style={styles.scrollView}>
39-
<Header />
40-
{!usingHermes ? null : (
41-
<View style={styles.engine}>
42-
<Text style={styles.footer}>Engine: Hermes</Text>
43-
</View>
44-
)}
45-
<View style={styles.body}>
46-
<View style={styles.sectionContainer}>
47-
<Text style={styles.sectionTitle}>Step One</Text>
48-
<Text style={styles.sectionDescription}>
49-
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
50-
screen and then come back to see your edits.
51-
</Text>
52-
</View>
53-
<View style={styles.sectionContainer}>
54-
<Text style={styles.sectionTitle}>See Your Changes</Text>
55-
<Text style={styles.sectionDescription}>
56-
<ReloadInstructions />
57-
</Text>
58-
</View>
59-
<View style={styles.sectionContainer}>
60-
<Text style={styles.sectionTitle}>Debug</Text>
61-
<Text style={styles.sectionDescription}>
62-
<DebugInstructions />
63-
</Text>
64-
</View>
65-
<View style={styles.sectionContainer}>
66-
<Text style={styles.sectionTitle}>Learn More</Text>
67-
<Text style={styles.sectionDescription}>
68-
Read the docs to discover what to do next:
69-
</Text>
70-
</View>
71-
<LearnMoreLinks />
72-
</View>
73-
</ScrollView>
74-
</SafeAreaView>
75-
</Fragment>
66+
<SafeAreaView style={backgroundStyle}>
67+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
68+
<ScrollView
69+
contentInsetAdjustmentBehavior="automatic"
70+
style={backgroundStyle}>
71+
<Header />
72+
<View
73+
style={{
74+
backgroundColor: isDarkMode ? Colors.black : Colors.white,
75+
}}>
76+
<Section title="Step One">
77+
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
78+
screen and then come back to see your edits.
79+
</Section>
80+
<Section title="See Your Changes">
81+
<ReloadInstructions />
82+
</Section>
83+
<Section title="Debug">
84+
<DebugInstructions />
85+
</Section>
86+
<Section title="Learn More">
87+
Read the docs to discover what to do next:
88+
</Section>
89+
<LearnMoreLinks />
90+
</View>
91+
</ScrollView>
92+
</SafeAreaView>
7693
);
7794
};
7895

7996
const styles = StyleSheet.create({
80-
scrollView: {
81-
backgroundColor: Colors.lighter,
82-
},
83-
engine: {
84-
position: 'absolute',
85-
right: 0,
86-
},
87-
body: {
88-
backgroundColor: Colors.white,
89-
},
9097
sectionContainer: {
9198
marginTop: 32,
9299
paddingHorizontal: 24,
93100
},
94101
sectionTitle: {
95102
fontSize: 24,
96103
fontWeight: '600',
97-
color: Colors.black,
98104
},
99105
sectionDescription: {
100106
marginTop: 8,
101107
fontSize: 18,
102108
fontWeight: '400',
103-
color: Colors.dark,
104109
},
105110
highlight: {
106111
fontWeight: '700',
107112
},
108-
footer: {
109-
color: Colors.dark,
110-
fontSize: 12,
111-
fontWeight: '600',
112-
padding: 4,
113-
paddingRight: 12,
114-
textAlign: 'right',
115-
},
116113
});
117114

118115
export default App;

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
React Native TypeScript Example
22
----
33

4-
```bash
5-
# Run instructions for iOS:
6-
npm run ios
7-
# - or -
8-
# • Open ReactNativeTypeScript/ios/ReactNativeTypeScript.xcworkspace in Xcode or run "xed -b ios"
9-
# • Hit the Run button
4+
```shell
5+
Run instructions for Android:
6+
• Have an Android emulator running (quickest way to get started), or a device connected.
7+
cd "/Users/wangchujiang/git-project/@uiw/react-native/AwesomeTSProject" && npx react-native run-android
108

11-
# Run instructions for Android:
12-
# Have an Android emulator running (quickest way to get started), or a device connected.
13-
npm run android
9+
Run instructions for iOS:
10+
cd "/Users/wangchujiang/git-project/@uiw/react-native/AwesomeTSProject" && npx react-native run-ios
11+
- or -
12+
• Open AwesomeTSProject/ios/AwesomeTSProject.xcworkspace in Xcode or run "xed -b ios"
13+
• Hit the Run button
14+
15+
Run instructions for macOS:
16+
• See https://aka.ms/ReactNativeGuideMacOS for the latest up-to-date instructions.
1417
```
1518

1619
Create a new TypeScript project:
1720

1821
```
19-
react-native init ReactNativeTypeScript --template typescript
20-
```
22+
npx react-native init AwesomeTSProject --template react-native-template-typescript
23+
```
24+

__tests__/App-test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ import renderer from 'react-test-renderer';
1111

1212
it('renders correctly', () => {
1313
renderer.create(<App />);
14-
});
14+
});

android/app/BUCK renamed to android/app/_BUCK

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ android_library(
3535

3636
android_build_config(
3737
name = "build_config",
38-
package = "com.reactnativetypescript",
38+
package = "com.awesometsproject",
3939
)
4040

4141
android_resource(
4242
name = "res",
43-
package = "com.reactnativetypescript",
43+
package = "com.awesometsproject",
4444
res = "src/main/res",
4545
)
4646

0 commit comments

Comments
 (0)