-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
156 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,59 @@ | ||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
*/ | ||
import React, {useState} from 'react'; | ||
import {Text, View} from 'react-native'; | ||
import TabView, {SceneMap} from 'react-native-bottom-tabs'; | ||
|
||
const ScreenA = () => ( | ||
<View> | ||
<Text>Screen A</Text> | ||
</View> | ||
); | ||
|
||
const ScreenB = () => ( | ||
<View> | ||
<Text>Screen B</Text> | ||
</View> | ||
); | ||
|
||
const ScreenC = () => ( | ||
<View> | ||
<Text>Screen C</Text> | ||
</View> | ||
); | ||
|
||
export default function App(): React.JSX.Element { | ||
const [index, setIndex] = useState(0); | ||
|
||
const [routes] = useState([ | ||
{ | ||
key: 'article', | ||
title: 'Article', | ||
focusedIcon: require('./icon.png'), | ||
badge: '!', | ||
}, | ||
{ | ||
key: 'albums', | ||
title: 'Albums', | ||
focusedIcon: require('./icon.png'), | ||
badge: '5', | ||
}, | ||
{ | ||
key: 'contacts', | ||
title: 'Contacts', | ||
focusedIcon: require('./icon.png'), | ||
}, | ||
]); | ||
|
||
const renderScene = SceneMap({ | ||
article: ScreenA, | ||
albums: ScreenB, | ||
contacts: ScreenC, | ||
}); | ||
|
||
import React from 'react'; | ||
import type {PropsWithChildren} from 'react'; | ||
import { | ||
SafeAreaView, | ||
ScrollView, | ||
StatusBar, | ||
StyleSheet, | ||
Text, | ||
useColorScheme, | ||
View, | ||
} from 'react-native'; | ||
|
||
import { | ||
Colors, | ||
DebugInstructions, | ||
Header, | ||
LearnMoreLinks, | ||
ReloadInstructions, | ||
} from 'react-native/Libraries/NewAppScreen'; | ||
|
||
type SectionProps = PropsWithChildren<{ | ||
title: string; | ||
}>; | ||
|
||
function Section({children, title}: SectionProps): React.JSX.Element { | ||
const isDarkMode = useColorScheme() === 'dark'; | ||
return ( | ||
<View style={styles.sectionContainer}> | ||
<Text | ||
style={[ | ||
styles.sectionTitle, | ||
{ | ||
color: isDarkMode ? Colors.white : Colors.black, | ||
}, | ||
]}> | ||
{title} | ||
</Text> | ||
<Text | ||
style={[ | ||
styles.sectionDescription, | ||
{ | ||
color: isDarkMode ? Colors.light : Colors.dark, | ||
}, | ||
]}> | ||
{children} | ||
</Text> | ||
</View> | ||
<TabView | ||
navigationState={{index, routes}} | ||
onIndexChange={setIndex} | ||
renderScene={renderScene} | ||
/> | ||
); | ||
} | ||
|
||
function App(): React.JSX.Element { | ||
const isDarkMode = useColorScheme() === 'dark'; | ||
|
||
const backgroundStyle = { | ||
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, | ||
}; | ||
|
||
return ( | ||
<SafeAreaView style={backgroundStyle}> | ||
<StatusBar | ||
barStyle={isDarkMode ? 'light-content' : 'dark-content'} | ||
backgroundColor={backgroundStyle.backgroundColor} | ||
/> | ||
<ScrollView | ||
contentInsetAdjustmentBehavior="automatic" | ||
style={backgroundStyle}> | ||
<Header /> | ||
<View | ||
style={{ | ||
backgroundColor: isDarkMode ? Colors.black : Colors.white, | ||
}}> | ||
<Section title="Step One"> | ||
Edit <Text style={styles.highlight}>App.tsx</Text> to change this | ||
screen and then come back to see your edits. | ||
</Section> | ||
<Section title="See Your Changes"> | ||
<ReloadInstructions /> | ||
</Section> | ||
<Section title="Debug"> | ||
<DebugInstructions /> | ||
</Section> | ||
<Section title="Learn More"> | ||
Read the docs to discover what to do next: | ||
</Section> | ||
<LearnMoreLinks /> | ||
</View> | ||
</ScrollView> | ||
</SafeAreaView> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
sectionContainer: { | ||
marginTop: 32, | ||
paddingHorizontal: 24, | ||
}, | ||
sectionTitle: { | ||
fontSize: 24, | ||
fontWeight: '600', | ||
}, | ||
sectionDescription: { | ||
marginTop: 8, | ||
fontSize: 18, | ||
fontWeight: '400', | ||
}, | ||
highlight: { | ||
fontWeight: '700', | ||
}, | ||
}); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters