I'm trying the save picture from expo camera. After that i will send this picture to cloudinary. Therefore i need base64 properties. But i have a problem.
takePictureAndCreateAlbum = async () => {
const { uri } = await this.camera.takePictureAsync({
base64: true
}).then(data => {
return (
this.setState({
data
}),
console.log("data", data)
)
}).catch(err => {
throw error;}
)
const asset = await MediaLibrary.createAssetAsync(uri);
MediaLibrary.createAlbumAsync('Expo', asset)
.then(() => {
Alert.alert('Album created!')
})
.catch(error => {
Alert.alert('An Error Occurred!')
});
this.sendCloudinary(this.state.data)
};
When I tried to save a picture, I got these errors:
Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property 'uri' of undefined
I checked another question and answers. But i didn't find a solution. How can i fix?