So I am trying to set a image source to the download url that I get back from Firebase Storage...the issue is that it is not showing the image but the console and download url both show correct Storage urls to pictures... here is my code that I currently have:
this.state = {
itemDataSource: ds,
modalVisible: false,
user: undefined,
imgSource: undefined,
};
getTrucks(truckRef, storageRef) {
truckRef.once('value', (snap) => {
console.log(snap.val());
// console.log(snap.key);
let trucks = [];
snap.forEach((trucksSnap) => {
console.log(trucksSnap.key);
uid = trucksSnap.key;
this.setState({user: uid});
trucksSnap.forEach((truckSnap) => {
console.log(truckSnap.key);
console.log(truckSnap.val());
let truck = truckSnap.val();
trucks.push({
uid: uid,
name: truck.name,
food: truck.foodType,
desc: truck.description,
menu: truck.menu,
phone: truck.phone,
});
});
});
console.log(trucks);
this.setState({
itemDataSource: this.state.itemDataSource.cloneWithRows(trucks)
});
});
}
getPics(storageRef) {
setTimeout(() => {
storageRef.ref('trucks/' + this.state.user + '/pic-1').getDownloadURL()
.then((url) => {
console.log(url);
this.setState({imgSource: url});
});
}, 3000);
}
<Image
source={{uri: this.state.imgSource}}
style={styles.iosCardImage}/>
the Image is in the render function and there is no image that shows up on screen but the console shows it other wise as the actual url that I can click on and see the image
I did look at other example questions though there was not an actual working answer posted or checked as correct.
React-Native: Download Image from Firebase Storage
Load and return an image from Firebase database/storage in React Native
React Native is at version 0.45.1 & Firebase is at version 4.1.3
Can someone please help me to set the source tag correctly who has done it before? Thank you