Skip to content

Instantly share code, notes, and snippets.

@manakuro
Created June 29, 2022 07:15
Show Gist options
  • Save manakuro/a50132e9224f8274e33784cd82bb03ef to your computer and use it in GitHub Desktop.
Save manakuro/a50132e9224f8274e33784cd82bb03ef to your computer and use it in GitHub Desktop.
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