I've successfully stored an image in firebase storage but whenever I want to retrieve the download url, it returns Object object. However the log shows valid string url.
P.S have a look at the code below. Thankyou
getImageUrl = async(fileName) => {
const { currentUser } = firebase.auth();
const ref = await firebase.storage().ref().child(`${currentUser.uid}/${fileName}.PNG`);
ref.getDownloadURL()
.then((url) => {
console.log('url', url); //this gives the valid img url
return url; //why is it returning the object?
}).catch(error => {
console.log('imageError', error);
return null;
});
}
render() {
return(
<View style={styles.container}>
<Text>{(`${this.getImageUrl('2F1560068528')}`)}</Text> //why is this showing an Object Object instead of download url?
</View>
);
}