const pickFromCamera = async ()=>{ const {granted} = await Permissions.askAsync(Permissions.CAMERA) if(granted){ let data = await ImagePicker.launchCameraAsync({ mediaTypes:ImagePicker.MediaTypeOptions.Images, allowsEditing:true, aspect:[1,1], quality:0.5 }) if(!data.cancelled){ let newfile = { uri:data.uri, type:`test/${data.uri.split(".")[1]}`, name:`test.${data.uri.split(".")[1]}` } handleUpload(newfile) } }else{ Alert.alert("you need to give up permission to work") } }
const split = result.uri.split('/') const fileName = split[split.length - 1] if (!result.cancelled) { const response = await fetch(result.uri) const blob = await response.blob()
const pickFromGallery = async ()=>{ const {granted} = await Permissions.askAsync(Permissions.CAMERA_ROLL) if(granted){ let data = await ImagePicker.launchImageLibraryAsync({ mediaTypes:ImagePicker.MediaTypeOptions.Images, allowsEditing:true, aspect:[1,1], quality:0.5 }) if(!data.cancelled){ let newfile = { uri:data.uri, type:`test/${data.uri.split(".")[1]}`, name:`test.${data.uri.split(".")[1]}` } handleUpload(newfile) } }else{ Alert.alert("you need to give up permission to work") } }