You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
import {Redirect, Tabs} from "expo-router";
|
|
import {useSession} from "@/ctx";
|
|
import {Text} from "react-native"
|
|
|
|
export default function TabBarLayout() {
|
|
const { session, isLoading } = useSession();
|
|
|
|
// You can keep the splash screen open, or render a loading screen like we do here.
|
|
if (isLoading) {
|
|
return <Text>Loading...</Text>;
|
|
}
|
|
|
|
// Only require authentication within the (app) group's layout as users
|
|
// need to be able to access the (auth) group and sign in again.
|
|
if (!session) {
|
|
// On web, static rendering will stop here as the user is not authenticated
|
|
// in the headless Node process that the pages are rendered in.
|
|
return <Redirect href="/reset-password" />;
|
|
}
|
|
return (
|
|
<Tabs
|
|
screenOptions={{
|
|
headerShown: false,
|
|
}}
|
|
initialRouteName={"(home)"}
|
|
>
|
|
<Tabs.Screen
|
|
name="(home)"
|
|
options={{
|
|
title: 'Home',
|
|
}}
|
|
/>
|
|
<Tabs.Screen
|
|
name="(profile)"
|
|
options={{
|
|
title: 'Profile',
|
|
}}
|
|
/>
|
|
</Tabs>
|
|
);
|
|
}
|