Created
June 29, 2022 07:15
-
-
Save manakuro/a50132e9224f8274e33784cd82bb03ef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const App = () => { | |
const isDarkMode = useColorScheme() === 'dark'; | |
const backgroundStyle = { | |
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, | |
}; | |
const [index, setIndex] = useState(0); | |
const [routes] = useState<TabViewRoute[]>( | |
tabRoutes as unknown as TabViewRoute[], | |
); | |
return ( | |
<SafeAreaView style={[backgroundStyle, {flex: 1}]}> | |
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> | |
<TabView<TabViewRoute> | |
navigationState={{index, routes}} | |
renderScene={renderScene} | |
onIndexChange={setIndex} | |
renderTabBar={props => <TabBar {...props} onIndexChange={setIndex} />} // Add here | |
/> | |
</SafeAreaView> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment