32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
// app/(tabs)/_layout.tsx
|
|
import { Tabs, router } from 'expo-router';
|
|
import { useEffect } from 'react';
|
|
import { Home, Users, Map, Settings, MapPin } from 'lucide-react-native';
|
|
import { useUserStore } from '@/store/useUserStore';
|
|
|
|
export default function TabLayout() {
|
|
const user = useUserStore((s) => s.user);
|
|
|
|
useEffect(() => {
|
|
if (!user) {
|
|
router.replace('/onboarding');
|
|
}
|
|
}, [user]);
|
|
|
|
return (
|
|
<Tabs
|
|
screenOptions={{
|
|
tabBarActiveTintColor: '#1A6B72',
|
|
tabBarInactiveTintColor: '#9CA3AF',
|
|
headerShown: false,
|
|
}}
|
|
>
|
|
<Tabs.Screen name="index" options={{ title: 'Home', tabBarIcon: ({ color, size }) => <Home size={size} color={color} /> }} />
|
|
<Tabs.Screen name="contacts" options={{ title: 'Contacts', tabBarIcon: ({ color, size }) => <Users size={size} color={color} /> }} />
|
|
<Tabs.Screen name="territories" options={{ title: 'Territories', tabBarIcon: ({ color, size }) => <MapPin size={size} color={color} /> }} />
|
|
<Tabs.Screen name="map" options={{ title: 'Map', tabBarIcon: ({ color, size }) => <Map size={size} color={color} /> }} />
|
|
<Tabs.Screen name="settings" options={{ title: 'Settings', tabBarIcon: ({ color, size }) => <Settings size={size} color={color} /> }} />
|
|
</Tabs>
|
|
);
|
|
}
|