Help needed for uploading single (for now) image from iOS + React Native +CameraRoll to Firebase storage.
Notes:
1. CameraRoll gives me node.image.uri.
2. Using the above uri below code returns me blob and blob gets uploaded to firebase storage ref.
fetch(uri)
.then(response => return response.blob())
.then(blob => {
var fileRef = firebase.storage().ref(imagename);
fileRef.put(blob, {contentType : 'image' + type})
.then(snapshot => {
}
.catch(error => {
//to do alert
})
})
Above code snippet creates a file in firebase storage but when I try to open the file it is corrupted.
Has anyone had any luck with this.
Thanks.