|
| 1 | +/** |
| 2 | + * Sample React Native App |
| 3 | + * https://github.com/facebook/react-native |
| 4 | + * |
| 5 | + * Generated with the TypeScript template |
| 6 | + * https://github.com/react-native-community/react-native-template-typescript |
| 7 | + * |
| 8 | + * @format |
| 9 | + */ |
| 10 | + |
| 11 | +import React, {type PropsWithChildren} from 'react'; |
| 12 | +import { |
| 13 | + SafeAreaView, |
| 14 | + ScrollView, |
| 15 | + StatusBar, |
| 16 | + StyleSheet, |
| 17 | + Text, |
| 18 | + useColorScheme, |
| 19 | + View, |
| 20 | +} from 'react-native'; |
| 21 | + |
| 22 | +import { |
| 23 | + Colors, |
| 24 | + DebugInstructions, |
| 25 | + Header, |
| 26 | + LearnMoreLinks, |
| 27 | + ReloadInstructions, |
| 28 | +} from 'react-native/Libraries/NewAppScreen'; |
| 29 | +import ThubView from './js/ThubViewNativeComponent'; |
| 30 | + |
| 31 | +const Section: React.FC< |
| 32 | + PropsWithChildren<{ |
| 33 | + title: string; |
| 34 | + }> |
| 35 | +> = ({children, title}) => { |
| 36 | + const isDarkMode = useColorScheme() === 'dark'; |
| 37 | + return ( |
| 38 | + <View style={styles.sectionContainer}> |
| 39 | + <Text |
| 40 | + style={[ |
| 41 | + styles.sectionTitle, |
| 42 | + { |
| 43 | + color: isDarkMode ? Colors.white : Colors.black, |
| 44 | + }, |
| 45 | + ]}> |
| 46 | + {title} |
| 47 | + </Text> |
| 48 | + <Text |
| 49 | + style={[ |
| 50 | + styles.sectionDescription, |
| 51 | + { |
| 52 | + color: isDarkMode ? Colors.light : Colors.dark, |
| 53 | + }, |
| 54 | + ]}> |
| 55 | + {children} |
| 56 | + </Text> |
| 57 | + </View> |
| 58 | + ); |
| 59 | +}; |
| 60 | + |
| 61 | +const App = () => { |
| 62 | + const isDarkMode = useColorScheme() === 'dark'; |
| 63 | + |
| 64 | + const backgroundStyle = { |
| 65 | + backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, |
| 66 | + }; |
| 67 | + |
| 68 | + return ( |
| 69 | + <SafeAreaView style={backgroundStyle}> |
| 70 | + <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> |
| 71 | + <ScrollView |
| 72 | + contentInsetAdjustmentBehavior="automatic" |
| 73 | + style={backgroundStyle}> |
| 74 | + <ThubView |
| 75 | + style={{margin: 20, width: 100, height: 100}} |
| 76 | + color={'#00A0FF'} |
| 77 | + /> |
| 78 | + <Header /> |
| 79 | + <View |
| 80 | + style={{ |
| 81 | + backgroundColor: isDarkMode ? Colors.black : Colors.white, |
| 82 | + }}> |
| 83 | + <Section title="Step One"> |
| 84 | + Edit <Text style={styles.highlight}>App.tsx</Text> to change this |
| 85 | + screen and then come back to see your edits. |
| 86 | + </Section> |
| 87 | + <Section title="See Your Changes"> |
| 88 | + <ReloadInstructions /> |
| 89 | + </Section> |
| 90 | + <Section title="Debug"> |
| 91 | + <DebugInstructions /> |
| 92 | + </Section> |
| 93 | + <Section title="Learn More"> |
| 94 | + Read the docs to discover what to do next: |
| 95 | + </Section> |
| 96 | + <LearnMoreLinks /> |
| 97 | + </View> |
| 98 | + </ScrollView> |
| 99 | + </SafeAreaView> |
| 100 | + ); |
| 101 | +}; |
| 102 | + |
| 103 | +const styles = StyleSheet.create({ |
| 104 | + sectionContainer: { |
| 105 | + marginTop: 32, |
| 106 | + paddingHorizontal: 24, |
| 107 | + }, |
| 108 | + sectionTitle: { |
| 109 | + fontSize: 24, |
| 110 | + fontWeight: '600', |
| 111 | + }, |
| 112 | + sectionDescription: { |
| 113 | + marginTop: 8, |
| 114 | + fontSize: 18, |
| 115 | + fontWeight: '400', |
| 116 | + }, |
| 117 | + highlight: { |
| 118 | + fontWeight: '700', |
| 119 | + }, |
| 120 | +}); |
| 121 | + |
| 122 | +export default App; |
0 commit comments