From 6aede83b39f1050b7528b243278a85e5623856be Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Mon, 30 Mar 2026 14:59:30 +0100 Subject: Integracion Firebase --- src/app/(protected)/_layout.tsx | 27 ++++++++++++++++++++++ src/app/(protected)/home.tsx | 50 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) (limited to 'src/app/(protected)') diff --git a/src/app/(protected)/_layout.tsx b/src/app/(protected)/_layout.tsx index e69de29..ffd3d5d 100644 --- a/src/app/(protected)/_layout.tsx +++ b/src/app/(protected)/_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 ProtectedLayout() { + const { user, loading } = useAuthSession(); + + if (loading) { + return ( + + + + ); + } + + if (!user) { + return ; + } + + return ; +} diff --git a/src/app/(protected)/home.tsx b/src/app/(protected)/home.tsx index e69de29..76a5bda 100644 --- a/src/app/(protected)/home.tsx +++ b/src/app/(protected)/home.tsx @@ -0,0 +1,50 @@ +import { Pressable, StyleSheet, Text, View } from 'react-native'; +import { useAuthSession } from '@/providers/AuthProvider'; + +export default function HomeScreen() { + const { user, logout } = useAuthSession(); + + return ( + + Inicio + + Bienvenido{user?.displayName ? `, ${user.displayName}` : ''} + + {user?.email} + + + Cerrar sesión + + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + padding: 24, + gap: 12, + }, + title: { + fontSize: 28, + fontWeight: '700', + }, + subtitle: { + fontSize: 18, + }, + email: { + color: '#555', + marginBottom: 20, + }, + button: { + backgroundColor: '#c62828', + paddingVertical: 14, + borderRadius: 10, + alignItems: 'center', + }, + buttonText: { + color: '#fff', + fontWeight: '600', + }, +}); -- cgit v1.2.3-54-g00ecf