From c927739f8f221feabb6e19af2c2667eda905a2eb Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Wed, 1 Apr 2026 02:58:40 +0100 Subject: foto de perfil por url firestore requiere pago por eso no se hace con imagen subida de galeria. --- src/app/(protected)/(tabs)/profile/index.tsx | 51 ++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'src/app/(protected)/(tabs)/profile/index.tsx') diff --git a/src/app/(protected)/(tabs)/profile/index.tsx b/src/app/(protected)/(tabs)/profile/index.tsx index 4af1fe0..1e87f21 100644 --- a/src/app/(protected)/(tabs)/profile/index.tsx +++ b/src/app/(protected)/(tabs)/profile/index.tsx @@ -7,6 +7,7 @@ import { TextInput, View, } from 'react-native'; +import { Image } from 'expo-image'; import { useAuthSession } from '@/providers/AuthProvider'; import { useProfile } from '@/features/profile/hooks/useProfile'; import { useUpdateProfile } from '@/features/profile/hooks/useUpdateProfile'; @@ -17,18 +18,21 @@ export default function ProfileScreen() { const { profile, loading, error, reload } = useProfile(); const { displayName, + photoURL, + setPhotoURL, setDisplayName, isSubmitting, error: updateError, successMessage, submit, - } = useUpdateProfile(profile?.displayName ?? ''); + } = useUpdateProfile(profile?.displayName ?? '', profile?.photoURL ?? ''); useEffect(() => { if (profile?.displayName) { setDisplayName(profile.displayName); } - }, [profile?.displayName]); + setPhotoURL(profile?.photoURL ?? ''); + }, [profile?.displayName, profile?.photoURL, setDisplayName, setPhotoURL]); const handleLogout = async () => { await logout(); @@ -59,6 +63,18 @@ export default function ProfileScreen() { Perfil + + {photoURL ? ( + + ) : ( + + + {displayName.trim().charAt(0).toUpperCase() || 'U'} + + + )} + + Correo {profile.email} @@ -70,6 +86,16 @@ export default function ProfileScreen() { placeholder="Tu nombre" /> + URL de la foto + + {updateError ? {updateError} : null} {successMessage ? {successMessage} : null} @@ -111,6 +137,27 @@ const styles = StyleSheet.create({ padding: 16, gap: 10, }, + avatarSection: { + alignItems: 'center', + gap: 12, + marginBottom: 8, + }, + avatar: { + width: 112, + height: 112, + borderRadius: 56, + backgroundColor: '#ddd', + }, + avatarPlaceholder: { + alignItems: 'center', + justifyContent: 'center', + backgroundColor: '#1f6feb', + }, + avatarPlaceholderText: { + color: '#fff', + fontSize: 36, + fontWeight: '700', + }, label: { fontSize: 14, fontWeight: '700', -- cgit v1.2.3-54-g00ecf