This line seems to be wrong: https://github.com/invertase/react-native-firebase/blob/master/lib/modules/storage/task.js#L55
then should be a function not a promise right?
I changed it to
this.then = promise.then.bind(promise);
and it works
@Damnum I noticed the same thing yesterday when trying to upload files. The type def will need to be changed too to match up with catch:
then: Promise<*>
catch: () => Promise<*>
+1.
Im getting: _Firebase2.default.storage(...).ref(...).putFile(...).then is not a function when calling: firebase.storage().ref('/image/1').putFile(image.uri).
v.1.0.10 | OS iOS
@Damnum @davidtrogers the fix for this is landing in v2. In the meantime you can use the callbacks instead of promises as a workaround.
@Salakar FYI and for interested people, I ended resolving the promise that comes from: firebase.storage().ref('/image/1').putFile(image.uri).then. Notice the final .then. That one returns the promise we need with the upload info. Then as soon as this is fixed, we麓ll have to remove all .then.
Examples:
await firebase.storage().ref('/image/1').putFile(image.uri).then (this Is the way I use it)
firebase.storage().ref('/image/1').putFile(image.uri).then().then() (not tested this way yet but it should work).
@Salakar Hi! Can you please give an example of how to use callbacks please.
I tried this but it didn't work.
firebase.storage()
.ref('/images/' + id)
.putFile(image.path, (uploadedFile)=>{
console.log('uploadedFile',uploadedFile);
});
@bennygenel I believe this was fixed in v1.1.0, try updating the npm module
@bennygenel yeah, I can confirm the storage works perfectly on v1.1.0
@Salakar & @andfk Thanks for the heads up. I updated and it fixed the problem.
Most helpful comment
+1.
Im getting:
_Firebase2.default.storage(...).ref(...).putFile(...).then is not a functionwhen calling:firebase.storage().ref('/image/1').putFile(image.uri).v.1.0.10|OS iOS