59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
|
|
import { Tabs } from 'expo-router';
|
||
|
|
import { Platform } from 'react-native';
|
||
|
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||
|
|
import { FontAwesome6 } from '@expo/vector-icons';
|
||
|
|
import { useTheme } from '@/hooks/useTheme';
|
||
|
|
|
||
|
|
export default function TabLayout() {
|
||
|
|
const { theme, isDark } = useTheme();
|
||
|
|
const insets = useSafeAreaInsets();
|
||
|
|
|
||
|
|
return (
|
||
|
|
<Tabs
|
||
|
|
screenOptions={{
|
||
|
|
headerShown: false,
|
||
|
|
tabBarStyle: {
|
||
|
|
backgroundColor: theme.backgroundDefault,
|
||
|
|
borderTopColor: theme.border,
|
||
|
|
height: Platform.OS === 'web' ? 60 : 50 + insets.bottom,
|
||
|
|
paddingBottom: Platform.OS === 'web' ? 0 : insets.bottom,
|
||
|
|
},
|
||
|
|
tabBarActiveTintColor: theme.primary,
|
||
|
|
tabBarInactiveTintColor: theme.textMuted,
|
||
|
|
tabBarItemStyle: {
|
||
|
|
height: Platform.OS === 'web' ? 60 : undefined,
|
||
|
|
},
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
<Tabs.Screen
|
||
|
|
name="index"
|
||
|
|
options={{
|
||
|
|
title: '首页',
|
||
|
|
tabBarIcon: ({ color }) => <FontAwesome6 name="house" size={20} color={color} />,
|
||
|
|
}}
|
||
|
|
/>
|
||
|
|
<Tabs.Screen
|
||
|
|
name="record"
|
||
|
|
options={{
|
||
|
|
title: '记录',
|
||
|
|
tabBarIcon: ({ color }) => <FontAwesome6 name="camera" size={20} color={color} />,
|
||
|
|
}}
|
||
|
|
/>
|
||
|
|
<Tabs.Screen
|
||
|
|
name="stats"
|
||
|
|
options={{
|
||
|
|
title: '统计',
|
||
|
|
tabBarIcon: ({ color }) => <FontAwesome6 name="chart-line" size={20} color={color} />,
|
||
|
|
}}
|
||
|
|
/>
|
||
|
|
<Tabs.Screen
|
||
|
|
name="chat"
|
||
|
|
options={{
|
||
|
|
title: 'AI助手',
|
||
|
|
tabBarIcon: ({ color }) => <FontAwesome6 name="robot" size={20} color={color} />,
|
||
|
|
}}
|
||
|
|
/>
|
||
|
|
</Tabs>
|
||
|
|
);
|
||
|
|
}
|