|
| 1 | +import type { FC } from 'react'; |
| 2 | +import { |
| 3 | + SafeAreaView, |
| 4 | + ScrollView, |
| 5 | + StatusBar, |
| 6 | + StyleSheet, |
| 7 | + Text, |
| 8 | + View, |
| 9 | + useColorScheme, |
| 10 | +} from 'react-native'; |
| 11 | +import { Provider } from 'react-redux'; |
| 12 | +import { store } from './src/app/store'; |
| 13 | +import { Counter } from './src/features/counter/Counter'; |
| 14 | + |
| 15 | +import { |
| 16 | + DebugInstructions, |
| 17 | + HermesBadge, |
| 18 | + LearnMoreLinks, |
| 19 | + ReloadInstructions, |
| 20 | +} from 'react-native/Libraries/NewAppScreen'; |
| 21 | +import { Header } from './src/components/Header'; |
| 22 | +import { LearnReduxLinks } from './src/components/LearnReduxLinks'; |
| 23 | +import { Section } from './src/components/Section'; |
| 24 | +import { TypedColors } from './src/constants/TypedColors'; |
| 25 | + |
| 26 | +export const App: FC = () => { |
| 27 | + const isDarkMode = useColorScheme() === 'dark'; |
| 28 | + |
| 29 | + const backgroundStyle = { |
| 30 | + backgroundColor: isDarkMode ? TypedColors.darker : TypedColors.lighter, |
| 31 | + }; |
| 32 | + |
| 33 | + return ( |
| 34 | + <Provider store={store}> |
| 35 | + <SafeAreaView style={backgroundStyle}> |
| 36 | + <StatusBar |
| 37 | + barStyle={isDarkMode ? 'light-content' : 'dark-content'} |
| 38 | + backgroundColor={backgroundStyle.backgroundColor} |
| 39 | + /> |
| 40 | + <ScrollView |
| 41 | + contentInsetAdjustmentBehavior="automatic" |
| 42 | + style={backgroundStyle}> |
| 43 | + <Header /> |
| 44 | + <HermesBadge /> |
| 45 | + <View |
| 46 | + style={{ |
| 47 | + backgroundColor: isDarkMode |
| 48 | + ? TypedColors.black |
| 49 | + : TypedColors.white, |
| 50 | + }}> |
| 51 | + <Counter /> |
| 52 | + <Section title="Step One"> |
| 53 | + Edit <Text style={styles.highlight}>App.tsx</Text> to change this |
| 54 | + screen and then come back to see your edits. |
| 55 | + </Section> |
| 56 | + <Section title="See Your Changes"> |
| 57 | + <ReloadInstructions /> |
| 58 | + </Section> |
| 59 | + <Section title="Debug"> |
| 60 | + <DebugInstructions /> |
| 61 | + </Section> |
| 62 | + <Section title="Learn More Redux"> |
| 63 | + Discover what to do next with Redux: |
| 64 | + </Section> |
| 65 | + <LearnReduxLinks /> |
| 66 | + <Section title="Learn More React Native"> |
| 67 | + Read the docs to discover what to do next: |
| 68 | + </Section> |
| 69 | + <LearnMoreLinks /> |
| 70 | + </View> |
| 71 | + </ScrollView> |
| 72 | + </SafeAreaView> |
| 73 | + </Provider> |
| 74 | + ); |
| 75 | +}; |
| 76 | + |
| 77 | +const styles = StyleSheet.create({ |
| 78 | + highlight: { |
| 79 | + fontWeight: '700', |
| 80 | + }, |
| 81 | +}); |
| 82 | + |
| 83 | +export default App; |
0 commit comments