Files
sub2api-mobile/app/(tabs)/_layout.tsx
2026-03-07 23:33:33 +08:00

61 lines
1.6 KiB
TypeScript

import { Tabs } from 'expo-router';
import { ChartNoAxesCombined, Settings2, Users } from 'lucide-react-native';
import { adminConfigState } from '@/src/store/admin-config';
const { useSnapshot } = require('valtio/react');
export default function TabsLayout() {
const config = useSnapshot(adminConfigState);
const hasAccount = Boolean(config.baseUrl.trim());
return (
<Tabs
initialRouteName={hasAccount ? 'monitor' : 'settings'}
screenOptions={{
headerShown: false,
tabBarActiveTintColor: '#1d5f55',
tabBarInactiveTintColor: '#8a8072',
tabBarStyle: {
backgroundColor: '#fbf8f2',
borderTopWidth: 0,
height: 84,
paddingTop: 10,
paddingBottom: 18,
},
}}
>
<Tabs.Screen
name="index"
options={{
href: null,
}}
/>
<Tabs.Screen
name="monitor"
options={{
title: '概览',
tabBarIcon: ({ color, size }) => <ChartNoAxesCombined color={color} size={size} />,
}}
/>
<Tabs.Screen
name="users"
options={{
title: '用户',
tabBarIcon: ({ color, size }) => <Users color={color} size={size} />,
}}
/>
<Tabs.Screen
name="settings"
options={{
title: '服务器',
tabBarIcon: ({ color, size }) => <Settings2 color={color} size={size} />,
}}
/>
<Tabs.Screen name="groups" options={{ href: null }} />
<Tabs.Screen name="keys" options={{ href: null }} />
<Tabs.Screen name="accounts" options={{ href: null }} />
</Tabs>
);
}