Files
life-echo/app-expo/src/app/(main)/_layout.tsx

24 lines
602 B
TypeScript

import { Redirect, Stack } from 'expo-router';
import React from 'react';
import { ActivityIndicator, View } from 'react-native';
import { useSession } from '@/features/auth/hooks';
export default function MainLayout() {
const { status } = useSession();
if (status === 'loading') {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<ActivityIndicator size="large" />
</View>
);
}
if (status === 'unauthenticated') {
return <Redirect href="/(auth)/login" />;
}
return <Stack screenOptions={{ headerShown: false }} />;
}