Skip to content

Commit 486681d

Browse files
authored
Update to @react-native/new-app-screen (#123)
1 parent 8509b5c commit 486681d

File tree

2 files changed

+8
-103
lines changed

2 files changed

+8
-103
lines changed

template/App.tsx

Lines changed: 6 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -5,126 +5,30 @@
55
* @format
66
*/
77

8-
import React from 'react';
9-
import type {PropsWithChildren} from 'react';
8+
import {NewAppScreen} from '@react-native/new-app-screen';
109
import {
11-
ScrollView,
1210
StatusBar,
1311
StyleSheet,
14-
Text,
1512
useColorScheme,
1613
View,
1714
} from 'react-native';
1815

19-
import {
20-
Colors,
21-
DebugInstructions,
22-
Header,
23-
LearnMoreLinks,
24-
ReloadInstructions,
25-
} from 'react-native/Libraries/NewAppScreen';
26-
27-
type SectionProps = PropsWithChildren<{
28-
title: string;
29-
}>;
30-
31-
function Section({children, title}: SectionProps): React.JSX.Element {
32-
const isDarkMode = useColorScheme() === 'dark';
33-
return (
34-
<View style={styles.sectionContainer}>
35-
<Text
36-
style={[
37-
styles.sectionTitle,
38-
{
39-
color: isDarkMode ? Colors.white : Colors.black,
40-
},
41-
]}>
42-
{title}
43-
</Text>
44-
<Text
45-
style={[
46-
styles.sectionDescription,
47-
{
48-
color: isDarkMode ? Colors.light : Colors.dark,
49-
},
50-
]}>
51-
{children}
52-
</Text>
53-
</View>
54-
);
55-
}
56-
57-
function App(): React.JSX.Element {
16+
function App() {
5817
const isDarkMode = useColorScheme() === 'dark';
5918

60-
const backgroundStyle = {
61-
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
62-
};
63-
64-
/*
65-
* To keep the template simple and small we're adding padding to prevent view
66-
* from rendering under the System UI.
67-
* For bigger apps the recommendation is to use `react-native-safe-area-context`:
68-
* https://github.com/AppAndFlow/react-native-safe-area-context
69-
*
70-
* You can read more about it here:
71-
* https://github.com/react-native-community/discussions-and-proposals/discussions/827
72-
*/
73-
const safePadding = '5%';
74-
7519
return (
76-
<View style={backgroundStyle}>
20+
<View style={styles.container}>
7721
<StatusBar
7822
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
79-
backgroundColor={backgroundStyle.backgroundColor}
8023
/>
81-
<ScrollView
82-
style={backgroundStyle}>
83-
<View style={{paddingRight: safePadding}}>
84-
<Header/>
85-
</View>
86-
<View
87-
style={{
88-
backgroundColor: isDarkMode ? Colors.black : Colors.white,
89-
paddingHorizontal: safePadding,
90-
paddingBottom: safePadding,
91-
}}>
92-
<Section title="Step One">
93-
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
94-
screen and then come back to see your edits.
95-
</Section>
96-
<Section title="See Your Changes">
97-
<ReloadInstructions />
98-
</Section>
99-
<Section title="Debug">
100-
<DebugInstructions />
101-
</Section>
102-
<Section title="Learn More">
103-
Read the docs to discover what to do next:
104-
</Section>
105-
<LearnMoreLinks />
106-
</View>
107-
</ScrollView>
24+
<NewAppScreen templateFileName="App.tsx" />
10825
</View>
10926
);
11027
}
11128

11229
const styles = StyleSheet.create({
113-
sectionContainer: {
114-
marginTop: 32,
115-
paddingHorizontal: 24,
116-
},
117-
sectionTitle: {
118-
fontSize: 24,
119-
fontWeight: '600',
120-
},
121-
sectionDescription: {
122-
marginTop: 8,
123-
fontSize: 18,
124-
fontWeight: '400',
125-
},
126-
highlight: {
127-
fontWeight: '700',
30+
container: {
31+
flex: 1,
12832
},
12933
});
13034

template/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"dependencies": {
1313
"react": "19.1.0",
14-
"react-native": "1000.0.0"
14+
"react-native": "1000.0.0",
15+
"@react-native/new-app-screen": "0.80.0-main"
1516
},
1617
"devDependencies": {
1718
"@babel/core": "^7.25.2",

0 commit comments

Comments
 (0)