|
5 | 5 | * @format |
6 | 6 | */ |
7 | 7 |
|
8 | | -import type {PropsWithChildren} from 'react'; |
9 | 8 | import React from 'react'; |
10 | | -import { |
11 | | - SafeAreaView, |
12 | | - StatusBar, |
13 | | - StyleSheet, |
14 | | - Text, |
15 | | - useColorScheme, |
16 | | - View, |
17 | | -} from 'react-native'; |
18 | 9 |
|
19 | | -import {Colors} from 'react-native/Libraries/NewAppScreen'; |
20 | 10 | import {RootStackNavigator} from '../../navigation/components/RootStackNavigator'; |
21 | 11 | import {AppProvider} from '../components/AppProvider'; |
22 | 12 | import {themeVariants} from '../themes'; |
23 | 13 |
|
24 | | -type SectionProps = PropsWithChildren<{ |
25 | | - title: string; |
26 | | -}>; |
27 | | - |
28 | | -function Section({children, title}: SectionProps): JSX.Element { |
29 | | - const isDarkMode = useColorScheme() === 'dark'; |
30 | | - return ( |
31 | | - <View style={styles.sectionContainer}> |
32 | | - <Text |
33 | | - style={[ |
34 | | - styles.sectionTitle, |
35 | | - { |
36 | | - color: isDarkMode ? Colors.white : Colors.black, |
37 | | - }, |
38 | | - ]}> |
39 | | - {title} |
40 | | - </Text> |
41 | | - <Text |
42 | | - style={[ |
43 | | - styles.sectionDescription, |
44 | | - { |
45 | | - color: isDarkMode ? Colors.light : Colors.dark, |
46 | | - }, |
47 | | - ]}> |
48 | | - {children} |
49 | | - </Text> |
50 | | - </View> |
51 | | - ); |
52 | | -} |
53 | | - |
54 | 14 | export function App(): JSX.Element { |
55 | | - const isDarkMode = useColorScheme() === 'dark'; |
56 | | - |
57 | | - const backgroundStyle = { |
58 | | - backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, |
59 | | - }; |
60 | | - |
61 | 15 | return ( |
62 | | - <SafeAreaView style={[{flex: 1}, backgroundStyle]}> |
63 | | - <AppProvider themeVariants={themeVariants}> |
64 | | - <StatusBar |
65 | | - barStyle={isDarkMode ? 'light-content' : 'dark-content'} |
66 | | - backgroundColor={backgroundStyle.backgroundColor} |
67 | | - /> |
68 | | - <RootStackNavigator /> |
69 | | - </AppProvider> |
70 | | - </SafeAreaView> |
| 16 | + <AppProvider themeVariants={themeVariants}> |
| 17 | + <RootStackNavigator /> |
| 18 | + </AppProvider> |
71 | 19 | ); |
72 | 20 | } |
73 | | - |
74 | | -const styles = StyleSheet.create({ |
75 | | - sectionContainer: { |
76 | | - marginTop: 32, |
77 | | - paddingHorizontal: 24, |
78 | | - }, |
79 | | - sectionTitle: { |
80 | | - fontSize: 24, |
81 | | - fontWeight: '600', |
82 | | - }, |
83 | | - sectionDescription: { |
84 | | - marginTop: 8, |
85 | | - fontSize: 18, |
86 | | - fontWeight: '400', |
87 | | - }, |
88 | | - highlight: { |
89 | | - fontWeight: '700', |
90 | | - }, |
91 | | -}); |
0 commit comments