Skip to content

Instantly share code, notes, and snippets.

@yjsoon
Created May 11, 2025 13:58
Show Gist options
  • Save yjsoon/a18ec6c62a72cc406f982c31d0db42f3 to your computer and use it in GitHub Desktop.
Save yjsoon/a18ec6c62a72cc406f982c31d0db42f3 to your computer and use it in GitHub Desktop.
Tab Navigation template for RN with React Navigation 7
import { Text, View } from 'react-native';
import { createStaticNavigation } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
// Screens -------------------------------------------------
const HomeScreen = () => (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Home!</Text>
</View>
);
const SettingsScreen = () => (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Settings!</Text>
</View>
);
// Navigator -----------------------------------------------
const Tabs = createBottomTabNavigator({
screens: {
Home: HomeScreen,
Settings: SettingsScreen,
},
});
// Root navigation component -------------------------------
const Navigation = createStaticNavigation(Tabs);
export default function App() {
return <Navigation />;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment