浏览代码

change tab bar height to height*0.105 and remove extra router.back()

Ian Fung 1 年之前
父节点
当前提交
b7f0425ef2
共有 2 个文件被更改,包括 16 次插入11 次删除
  1. 15 9
      app/(auth)/(tabs)/_layout.tsx
  2. 1 2
      component/reservationLocationPage/reservationLocationPageComponent.tsx

+ 15 - 9
app/(auth)/(tabs)/_layout.tsx

@@ -1,13 +1,15 @@
 import React from 'react';
 import { Tabs } from 'expo-router';
-
-import { Platform } from 'react-native';
-
-import Svg, { Path } from 'react-native-svg';
-import {TabAccountIcon, TabChargingIcon, TabHomeIcon } from '../../../component/global/SVG';
-
+import { Dimensions, Platform } from 'react-native';
+import {
+    TabAccountIcon,
+    TabChargingIcon,
+    TabHomeIcon
+} from '../../../component/global/SVG';
 
 export default function TabLayout() {
+    const { height } = Dimensions.get('window');
+    
     return (
         <Tabs
             screenOptions={{
@@ -17,7 +19,7 @@ export default function TabLayout() {
                     marginBottom: Platform.OS === 'ios' ? 0 : 25
                 },
                 tabBarStyle: {
-                    height: 100
+                    height: height * 0.105,    
                 }
             }}
         >
@@ -37,7 +39,9 @@ export default function TabLayout() {
                     title: '充電',
                     tabBarHideOnKeyboard: true,
                     tabBarIcon: ({ focused }) => (
-                        <TabChargingIcon color={focused ? '#02677D' : '#BBBBBB'} />
+                        <TabChargingIcon
+                            color={focused ? '#02677D' : '#BBBBBB'}
+                        />
                     )
                 }}
             />
@@ -47,7 +51,9 @@ export default function TabLayout() {
                     title: '帳戶',
                     tabBarHideOnKeyboard: true,
                     tabBarIcon: ({ focused, color }) => (
-                        <TabAccountIcon color={focused ? '#02677D' : '#BBBBBB'} />
+                        <TabAccountIcon
+                            color={focused ? '#02677D' : '#BBBBBB'}
+                        />
                     )
                 }}
             />

+ 1 - 2
component/reservationLocationPage/reservationLocationPageComponent.tsx

@@ -154,7 +154,7 @@ const LocationTabComponent: React.FC<TabViewComponentProps> = ({
     );
 
     //tab 2
-   
+
     const SecondRoute = () => (
         <View style={{ flex: 1, backgroundColor: 'white' }}>
             <FlashList
@@ -304,7 +304,6 @@ const ReservationLocationPage = () => {
                                     } else {
                                         router.replace('/');
                                     }
-                                    router.back();
                                 }}
                             >
                                 <CrossLogoSvg />