Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
[ad_1]
So I’ve a picture that’s saved in Firebase storage, and I am retrieving the downloadURL and pushing it into an array (const [banner, setBanner] = React.useState([])), after which having the photographs within the array be displayed in a banner (there might be a number of pictures); here’s what it seems like:
React.useEffect(() =>{
fetchData();
getBanner();
}, [])
const getBanner = async() => {
await storage().ref('pictures/' + 'user1' + "https://stackoverflow.com/" + 'banner/').listAll().then(operate (outcome) {
outcome.objects.forEach((itemRef) => {
itemRef.getDownloadURL().then((hyperlink) => {
const fetched = hyperlink
banner.push(fetched)
setBanner(banner)
})
})
})
}
const fetchData = async() =>{
const userData = await firestore().assortment("Customers").doc('user1').get();
setUserData(userData);
}
After I first initialized getBanner, it labored high-quality, and the picture appeared, so I went to a special display within the emulator, and after I got here again to the display with the banner, the picture was not seen, only a grey display, and the banner array that the photographs have been pushed into was now empty (this even happens after I restart the emulator, or refresh Metro).
How banner is rendered:
{
banner.map((image, index) => (
banner.size === 0 ?
<Picture
supply={pictures.noimage}
resizeMode="cowl"
model={{
width: SIZES.width,
peak: '100%'
}}
/>
:
<Picture
key={index}
supply={{uri: image}}
resizeMode="cowl"
model={{
width: SIZES.width,
peak: '100%'
}}
/>
))
}
Why is that this occurring?
[ad_2]