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/index.tsx | |
| parent | 83fd8f35b080e364e667697c12d4ace7f06450df (diff) | |
Integracion Firebase
Diffstat (limited to 'src/app/index.tsx')
| -rw-r--r-- | src/app/index.tsx | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/src/app/index.tsx b/src/app/index.tsx index cf5f7c1..eacde3c 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -1,39 +1,27 @@ -import { router } from "expo-router"; -import { Button, Text, View } from "react-native"; -import { SafeAreaView } from "react-native-safe-area-context"; +import { Redirect } from 'expo-router'; +import { ActivityIndicator, View } from 'react-native'; +import { useAuthSession } from '@/providers/AuthProvider'; -export default function Index() { +export default function IndexPage() { + const { user, loading } = useAuthSession(); - - function navegarGuardarPersona(){ - console.log("ir a pantalla") - router.push({ - pathname: "/GuardarPersona", - //params: - }) + if (loading) { + return ( + <View + style={{ + flex: 1, + alignItems: 'center', + justifyContent: 'center', + }} + > + <ActivityIndicator size="large" /> + </View> + ); } + if (user) { + return <Redirect href="/(protected)/home" />; + } - function navegarGuardarProducto(){ - console.log("ir a pantalla") - router.push({ - pathname: "/GuardarProducto", - //params: - }) - } - return ( - <SafeAreaView - style={{ - flex: 1, - justifyContent: "center", - alignItems: "center", - }} - > - - <Button title="crear usuario " testID="btn-crear-usuario" color={"green"} onPress={()=> navegarGuardarPersona()} /> - {/* - <Button title="crear categorias y productos " testID="btn-crear-categoria-producto" color={"blue"} onPress={()=> navegarGuardarProducto()} /> - */} - </SafeAreaView> - ); + return <Redirect href="/(auth)/welcome" />; } |