diff options
| author | Alberto Duarte Delgado <alberto@albertoduarte.com> | 2026-03-30 14:59:30 +0100 |
|---|---|---|
| committer | Alberto Duarte Delgado <alberto@albertoduarte.com> | 2026-03-30 14:59:30 +0100 |
| commit | 6aede83b39f1050b7528b243278a85e5623856be (patch) | |
| tree | db0f2c89b18de3837f1bdf081409b09f9a763d5b /src/app/(auth)/_layout.tsx | |
| parent | 83fd8f35b080e364e667697c12d4ace7f06450df (diff) | |
Integracion Firebase
Diffstat (limited to 'src/app/(auth)/_layout.tsx')
| -rw-r--r-- | src/app/(auth)/_layout.tsx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/app/(auth)/_layout.tsx b/src/app/(auth)/_layout.tsx index e69de29..1fa69af 100644 --- a/src/app/(auth)/_layout.tsx +++ b/src/app/(auth)/_layout.tsx @@ -0,0 +1,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 }} />; +} |