import { Redirect, Tabs } from "expo-router"
import React from "react"
import { TabBarIcon } from "@/presentation/react/components/TabBarIcon"
import { useAuthentication } from "@/presentation/react/contexts/Authentication"
const TabLayout: React.FC = () => {
const { user } = useAuthentication()
if (user == null) {
return <Redirect href="/authentication/login" />
}
return (
<Tabs
screenOptions={{
headerShown: false,
}}
>
<Tabs.Screen
name="habits/index"
options={{
title: "Habits",
tabBarIcon: ({ color }) => {
return <TabBarIcon name="sticky-note" color={color} />
},
/>
name="habits/new"
title: "New Habit",
return <TabBarIcon name="plus-square" color={color} />
name="habits/[habitId]"
href: null,
name="habits/history"
title: "History",
return <TabBarIcon name="history" color={color} />
name="users/settings"
title: "Settings",
return <TabBarIcon name="cog" color={color} />
</Tabs>
)
export default TabLayout