I am trying to upload this image to Firebase Storage. Somehow I get no errors whatsoever but nothing is getting uploaded to the database. The task returns nothing about task progress or completion. I am using Firebase auth for authentication and that works fine which I believe means that I have set up firebase correctly. I am using the IOS simulator.
import firestore from '@react-native-firebase/firestore';
import storage from '@react-native-firebase/storage';
let objectupload = {...eventobject}
const uri = objectupload.eventdetails.details.Description.media[0].uri;
const uploadUri = Platform.OS === 'ios' ? uri.replace('file://', '') : uri;
const uploadpath = `post/ ${firebase.auth().currentUser.uid}/${eventobject.eventdetails.eventname}/${Math.random().toString(36)}`;
const task = firebase
.storage()
.ref(uploadpath)
.putFile(uploadUri);
const taskprogress = snapshot => {
console.log(`transfered: ${snapshot.bytesTransferred}`)
}
const taskCompleted = snapshot => {
snapshot.ref.getDownloadURL().then((snapshot) => {
console.log(snapshot)
})
const taskError = snapshot => {
console.log(snapshot)
}
task.on("state_changed", taskprogress, taskCompleted, taskError);
}
I looked at this tutorial to write this code. I am not sure what I might be missing here.