bw-expo-app/app/(tabs)/_layout.tsx

64 lines
1.6 KiB
TypeScript

import { Tabs } from 'expo-router';
import React from 'react';
import { Image } from 'react-native';
import { HapticTab } from '@/components/haptic-tab';
import { Colors } from '@/constants/theme';
import { useAuth } from '@/hooks/use-auth';
import { useColorScheme } from '@/hooks/use-color-scheme';
export default function TabLayout() {
const colorScheme = useColorScheme();
const { isAuthenticated, isLoading } = useAuth();
if (isLoading) {
return null;
}
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
headerShown: false,
tabBarButton: HapticTab,
}}>
<Tabs.Screen
name="home"
options={{
title: 'Home',
tabBarIcon: ({ color }) => (
<Image
source={require('@/assets/icons/home.svg')}
style={{ width: 28, height: 28, tintColor: color as any }}
/>
),
}}
/>
<Tabs.Screen
name="history"
options={{
title: 'Content',
tabBarIcon: ({ color }) => (
<Image
source={require('@/assets/icons/content.svg')}
style={{ width: 28, height: 28, tintColor: color as any }}
/>
),
}}
/>
<Tabs.Screen
name="profile"
options={{
title: 'Profile',
tabBarIcon: ({ color }) => (
<Image
source={require('@/assets/icons/user.svg')}
style={{ width: 28, height: 28, tintColor: color as any }}
/>
),
}}
/>
</Tabs>
);
}