feat: check if image was selected

This commit is contained in:
Vinicius Souza 2024-10-28 09:50:24 -03:00
parent 0d8610a969
commit c0761c9623

View file

@ -9,12 +9,17 @@ import { UserPhoto } from '@components/UserPhoto';
export function Profile() { export function Profile() {
async function handleUserPhotoSelection() { async function handleUserPhotoSelection() {
await ImagePicker.launchImageLibraryAsync({ const photoSelection = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images, mediaTypes: ImagePicker.MediaTypeOptions.Images,
quality: 1, quality: 1,
aspect: [4, 4], aspect: [4, 4],
allowsEditing: true, allowsEditing: true,
}); });
if (photoSelection.canceled) {
return;
}
console.debug(JSON.stringify(photoSelection.assets[0], null, 2));
} }
return ( return (