|
8 | 8 | * @format |
9 | 9 | */ |
10 | 10 |
|
11 | | - import React from 'react'; |
12 | | - import { |
13 | | - SafeAreaView, |
14 | | - ScrollView, |
15 | | - StatusBar, |
16 | | - StyleSheet, |
17 | | - Text, |
18 | | - useColorScheme, |
19 | | - View, |
20 | | - } from 'react-native'; |
| 11 | +import React from 'react'; |
| 12 | +import { |
| 13 | + SafeAreaView, |
| 14 | + ScrollView, |
| 15 | + StatusBar, |
| 16 | + StyleSheet, |
| 17 | + Text, |
| 18 | + useColorScheme, |
| 19 | + View, |
| 20 | +} from 'react-native'; |
21 | 21 |
|
22 | | - import { |
23 | | - Colors, |
24 | | - DebugInstructions, |
25 | | - Header, |
26 | | - LearnMoreLinks, |
27 | | - ReloadInstructions, |
28 | | - } from 'react-native/Libraries/NewAppScreen'; |
| 22 | +import { |
| 23 | + Colors, |
| 24 | + DebugInstructions, |
| 25 | + Header, |
| 26 | + LearnMoreLinks, |
| 27 | + ReloadInstructions, |
| 28 | +} from 'react-native/Libraries/NewAppScreen'; |
29 | 29 |
|
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 | | - }; |
| 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 | 57 |
|
58 | | - const App = () => { |
59 | | - const isDarkMode = useColorScheme() === 'dark'; |
| 58 | +const App = () => { |
| 59 | + const isDarkMode = useColorScheme() === 'dark'; |
60 | 60 |
|
61 | | - const backgroundStyle = { |
62 | | - backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, |
63 | | - }; |
| 61 | + const backgroundStyle = { |
| 62 | + backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, |
| 63 | + }; |
64 | 64 |
|
65 | | - return ( |
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.js</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> |
93 | | - ); |
94 | | - }; |
| 65 | + return ( |
| 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.js</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> |
| 93 | + ); |
| 94 | +}; |
95 | 95 |
|
96 | | - const styles = StyleSheet.create({ |
97 | | - sectionContainer: { |
98 | | - marginTop: 32, |
99 | | - paddingHorizontal: 24, |
100 | | - }, |
101 | | - sectionTitle: { |
102 | | - fontSize: 24, |
103 | | - fontWeight: '600', |
104 | | - }, |
105 | | - sectionDescription: { |
106 | | - marginTop: 8, |
107 | | - fontSize: 18, |
108 | | - fontWeight: '400', |
109 | | - }, |
110 | | - highlight: { |
111 | | - fontWeight: '700', |
112 | | - }, |
113 | | - }); |
| 96 | +const styles = StyleSheet.create({ |
| 97 | + sectionContainer: { |
| 98 | + marginTop: 32, |
| 99 | + paddingHorizontal: 24, |
| 100 | + }, |
| 101 | + sectionTitle: { |
| 102 | + fontSize: 24, |
| 103 | + fontWeight: '600', |
| 104 | + }, |
| 105 | + sectionDescription: { |
| 106 | + marginTop: 8, |
| 107 | + fontSize: 18, |
| 108 | + fontWeight: '400', |
| 109 | + }, |
| 110 | + highlight: { |
| 111 | + fontWeight: '700', |
| 112 | + }, |
| 113 | +}); |
114 | 114 |
|
115 | | - export default App; |
| 115 | +export default App; |
0 commit comments