blob: 1fa69afe05d8fc649033aa85a0a0af038428bb71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { Stack, Redirect } from 'expo-router';
import { useAuthSession } from '@/providers/AuthProvider';
import { ActivityIndicator, View } from 'react-native';
export default function AuthLayout() {
const { user, loading } = useAuthSession();
if (loading) {
return (
<View
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}
>
<ActivityIndicator size="large" />
</View>
);
}
if (user) {
return <Redirect href="/(protected)/home" />;
}
return <Stack screenOptions={{ headerShown: false }} />;
}
|