chore: 修复一下导航布局

This commit is contained in:
Junhui Chen 2025-08-07 19:14:46 +08:00
parent 162f3b91e4
commit fd5ea7f318
3 changed files with 19 additions and 30 deletions

View File

@ -1,5 +1,3 @@
import { HapticTab } from '@/components/HapticTab';
import AskNavbar from '@/components/layout/ask';
import { TabBarIcon } from '@/components/navigation/TabBarIcon';
import { requestNotificationPermission } from '@/components/owner/utils';
import TabBarBackground from '@/components/ui/TabBarBackground';
@ -191,25 +189,21 @@ export default function TabLayout() {
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
headerShown: false,
tabBarButton: HapticTab,
tabBarBackground: TabBarBackground,
tabBarStyle: Platform.select({
ios: {
// Use a transparent background on iOS to show the blur effect
position: 'absolute',
},
default: {},
}),
tabBarShowLabel: false,
tabBarStyle: {
position: 'absolute',
borderTopWidth: 0,
elevation: 0,
height: Platform.OS === 'ios' ? 90 : 70,
},
tabBarBackground: () => <TabBarBackground />,
}}
>
{/* 落地页 */}
<Tabs.Screen
name="index"
options={{
title: 'Memo',
tabBarButton: () => null, // 隐藏底部标签栏
headerShown: false, // 隐藏导航栏
tabBarStyle: { display: 'none' } // 确保在标签栏中不显示
href: null,
}}
/>
{/* 登录 */}
@ -260,10 +254,7 @@ export default function TabLayout() {
<Tabs.Screen
name="ask"
options={{
title: 'ask',
tabBarButton: () => null, // 隐藏底部标签栏
headerShown: false, // 隐藏导航栏
tabBarStyle: { display: 'none' }, // 确保在标签栏中不显示
href: null,
...TransitionPresets.ShiftTransition,
}}
/>
@ -271,10 +262,7 @@ export default function TabLayout() {
<Tabs.Screen
name="memo-list"
options={{
title: 'memo-list',
tabBarButton: () => null, // 隐藏底部标签栏
headerShown: false, // 隐藏导航栏
tabBarStyle: { display: 'none' }, // 确保在标签栏中不显示
href: null,
...TransitionPresets.ShiftTransition,
}}
/>
@ -282,10 +270,7 @@ export default function TabLayout() {
<Tabs.Screen
name="owner"
options={{
title: 'owner',
tabBarButton: () => null, // 隐藏底部标签栏
headerShown: false, // 隐藏导航栏
tabBarStyle: { display: 'none' }, // 确保在标签栏中不显示
href: null,
...TransitionPresets.ShiftTransition,
}}
/>
@ -377,7 +362,6 @@ export default function TabLayout() {
}}
/>
</Tabs >
<AskNavbar wsStatus={wsStatus} />
</>
);
}

View File

@ -267,7 +267,7 @@ export default function AskScreen() {
console.log('失去焦点失败:', error);
}
Keyboard.dismiss();
router.navigate('/memo-list');
router.replace('/memo-list');
}}
>
<ReturnArrow />

View File

@ -1,5 +1,10 @@
import React from 'react';
import { View } from 'react-native';
// This is a shim for web and Android where the tab bar is generally opaque.
export default undefined;
export default function TabBarBackground() {
return <View style={{ flex: 1, backgroundColor: 'transparent' }} />;
}
export function useBottomTabOverflow() {
return 0;