-
Notifications
You must be signed in to change notification settings - Fork 0
BottomTabNavigationBar : With Stack
Asep Septiadi edited this page Jan 12, 2024
·
1 revision
Install library terlebih dahulu
yarn add @react-navigation/bottom-tabs
cd ios/
pod installLalu ikuti kodingan berikut di Apps.js
import * as React from 'react';
import { View, Text, Pressable } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
function HomeScreen({ navigation }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Pressable
onPress={() => {
navigation.navigate('Details')
}}
>
<View
style={{
backgroundColor: 'orange',
borderRadius: 8
}}
>
<Text style={{ padding: 10, color: 'white', fontWeight: 'bold' }}>Detail Page</Text>
</View>
</Pressable>
</View>
);
}
function DetailsScreen() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Selamat Datang di Details Screen</Text>
</View>
);
}
const Tab = createBottomTabNavigator();
function App() {
return (
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="Details" component={DetailsScreen} />
</Tab.Navigator>
</NavigationContainer>
);
}
export default App;RPReplay_Final1705044428.MP4
Copyright 2024 Asep Septiadi. All right reserved.