From 449c6a74670398e8cf64aa8898d94773ce0d3ea8 Mon Sep 17 00:00:00 2001 From: ducht Date: Tue, 18 May 2021 16:56:36 +0700 Subject: [PATCH] update navigation --- navigation/BottomTabNavigator.tsx | 99 +++++++++++++++++-------------- screens/CartStep.tsx | 2 +- screens/HomePage.tsx | 51 +++++++++------- 3 files changed, 85 insertions(+), 67 deletions(-) diff --git a/navigation/BottomTabNavigator.tsx b/navigation/BottomTabNavigator.tsx index 1fbd2ea..8bbd4cc 100644 --- a/navigation/BottomTabNavigator.tsx +++ b/navigation/BottomTabNavigator.tsx @@ -36,49 +36,10 @@ import CustomerInfo from '../screens/CustomerInfo'; import { HeaderHome, HeaderCategory, HeaderProductDetail, HeaderAllOtherPage, HeaderLogin } from '../components/header/HeaderAllPage' -const BottomTab = createBottomTabNavigator(); -export default function BottomTabNavigator() { +export default function AllNavigator() { const colorScheme = useColorScheme(); return ( - - , - }} - /> - , - }} - /> - , - }} - /> - , - }} - /> - , - }} - /> - + ); } @@ -106,7 +67,8 @@ function HomePageNavigator({ navigation }: { navigation: any }) { headerStyle: { backgroundColor: '#fff', height: 100, - } + }, + animationEnabled: true, }} /> @@ -603,7 +565,51 @@ function CustomerInfoNavigation() { ); } - +const BottomTab = createBottomTabNavigator(); +function BottomTabNavigator() { + const colorScheme = useColorScheme(); + return ( + + , + }} + /> + , + }} + /> + , + }} + /> + , + }} + /> + , + }} + /> + + ); +} const AllStack = createStackNavigator(); function AllStackNavigation() { @@ -611,7 +617,7 @@ function AllStackNavigation() { + { const navigation = useNavigation(); return ( - navigation.navigate('Cart')}> + navigation.goBack()}> Thanh toán diff --git a/screens/HomePage.tsx b/screens/HomePage.tsx index 3a11093..4b19b97 100644 --- a/screens/HomePage.tsx +++ b/screens/HomePage.tsx @@ -7,6 +7,7 @@ import { Text, View } from '../components/Themed'; import { TextInput } from 'react-native-gesture-handler'; import Swiper from 'react-native-swiper'; import { Asset } from 'expo-asset'; +import { useNavigation } from '@react-navigation/core'; export default function HomePage() { return ( @@ -67,63 +68,65 @@ const SliderHome = () => { } const CategoryHomePage = () => { + const navigation = useNavigation(); return ( - - + + navigation.navigate('ProductHotListNav')} style={styles.boxCatHomeItem}> Siêu phẩm hè - - + + navigation.navigate('ProductCategory')} style={styles.boxCatHomeItem}> Diện gia dụng - - + + navigation.navigate('ProductCategory')} style={styles.boxCatHomeItem}> Đồ gia dụng - - + + navigation.navigate('ProductCategory')} style={styles.boxCatHomeItem}> Thiết bị nhà bếp - - + + navigation.navigate('ProductCategory')} style={styles.boxCatHomeItem}> Điều hòa - - + + navigation.navigate('ProductCategory')} style={styles.boxCatHomeItem}> Khẩu trang vải - - + + navigation.navigate('ProductCategory')} style={styles.boxCatHomeItem}> Deal Hot - - + + navigation.navigate('ProductCategory')} style={[styles.boxCatHomeItem, styles.boxCatHomeItemLast]}> Combo - + ) } const FlastSale = () => { + const navigation = useNavigation(); return ( @@ -134,10 +137,14 @@ const FlastSale = () => { - - - - NỒI CHIÊN KHÔNG DẦU SMARTPLUS NAGAKAWA NAG3303 (9L) + navigation.navigate('ProductDetail')}> + + + + + navigation.navigate('ProductDetail')}> + NỒI CHIÊN KHÔNG DẦU SMARTPLUS NAGAKAWA NAG3303 (9L) + Giá sốc online @@ -1299,7 +1306,7 @@ const styles = StyleSheet.create({ alignItems: 'center', }, boxProductHomeItem: { - width: winWidth/2 - 15, + width: winWidth / 2 - 15, marginRight: 10, marginBottom: 10, borderRadius: 10,