Reputation: 2999
In iOS, everything is fine except image not save. Camera capture and retrieve url to image component all fine. But when I check back to photo / gallery , captured photo are not there.
Options that I use :
var optionsIOS = {
title: 'Select Avatar',
cancelButtonTitle:'Cancel',
takePhotoButtonTitle:'Photo Capture',
chooseFromLibraryButtonTitle:'Choose from Gallery',
quality:0.5,
storageOptions: {
skipBackup: true,
}
};
Upvotes: 1
Views: 1387
Reputation: 8640
To answer the question, you need to set cameraRoll
props to true like this:
var optionsIOS = {
title: 'Select Avatar',
cancelButtonTitle:'Cancel',
takePhotoButtonTitle:'Photo Capture',
chooseFromLibraryButtonTitle:'Choose from Gallery',
quality:0.5,
storageOptions: {
cameraRoll: true,
skipBackup: true
}
};
You can all the different props here.
Upvotes: 1
Reputation: 701
Code below is what I use in my RN App to save an image.
saveToCameraRoll = (image) => {
if (Platform.OS === 'android') {
RNFetchBlob
.config({
fileCache : true,
appendExt : 'jpg'
})
.fetch('GET', image.urls.small)
.then((res) => {
CameraRoll.saveToCameraRoll(res.path())
.then(Alert.alert('Success', 'Photo added to camera roll!'))
.catch(err => console.log('err:', err))
})
} else {
CameraRoll.saveToCameraRoll(image.urls.small)
.then(Alert.alert('Success', 'Photo added to camera roll!'))
}
}
Upvotes: 0