feat: replace profile photo
This commit is contained in:
parent
c0761c9623
commit
ece86755ee
1 changed files with 6 additions and 6 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { useState } from 'react';
|
||||
import { ScrollView, TouchableOpacity } from 'react-native';
|
||||
import { Center, Heading, Text, VStack } from '@gluestack-ui/themed';
|
||||
import * as ImagePicker from 'expo-image-picker';
|
||||
|
|
@ -8,6 +9,8 @@ import { ScreenHeader } from '@components/ScreenHeader';
|
|||
import { UserPhoto } from '@components/UserPhoto';
|
||||
|
||||
export function Profile() {
|
||||
const [userPhoto, setUserPhoto] = useState('https://i.pravatar.cc/200');
|
||||
|
||||
async function handleUserPhotoSelection() {
|
||||
const photoSelection = await ImagePicker.launchImageLibraryAsync({
|
||||
mediaTypes: ImagePicker.MediaTypeOptions.Images,
|
||||
|
|
@ -19,7 +22,8 @@ export function Profile() {
|
|||
if (photoSelection.canceled) {
|
||||
return;
|
||||
}
|
||||
console.debug(JSON.stringify(photoSelection.assets[0], null, 2));
|
||||
|
||||
setUserPhoto(photoSelection.assets[0].uri);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -28,11 +32,7 @@ export function Profile() {
|
|||
|
||||
<ScrollView contentContainerStyle={{ paddingHorizontal: 36 }}>
|
||||
<Center mt="$6" px="$10">
|
||||
<UserPhoto
|
||||
source={{ uri: 'https://i.pravatar.cc/200' }}
|
||||
alt="imagem de perfil"
|
||||
size="xl"
|
||||
/>
|
||||
<UserPhoto source={{ uri: userPhoto }} alt="imagem de perfil" size="xl" />
|
||||
|
||||
<TouchableOpacity onPress={handleUserPhotoSelection}>
|
||||
<Text color="$green500" fontFamily="$heading" fontSize="$md" mt="$2" mb="$8">
|
||||
|
|
|
|||
Loading…
Reference in a new issue