【发布时间】:2021-05-14 19:29:50
【问题描述】:
您好,我想弄清楚如何在 Firebase 存储中名为“VerifiedPhotos”的文件夹中显示所有图像。我不想像下面那样通过图像名称引用它们,因为我有多个图像。如何获取所有图像 URL 列表并在 React Native 中将它们显示到我的屏幕上?请帮助我整周都在查找如何使用 listAll() 并且我也不确定如何在 return 语句中显示多个图像。请帮忙。
const Photos = () => {
const [imageUrl, setImageUrl] = useState(undefined);
useEffect(() => {
firebase.storage()
.ref('VerifiedPhotos/' + '3.png') //name in storage in firebase console
.getDownloadURL()
.then((url) => {
setImageUrl(url);
})
.catch((e) => console.log('Errors while downloading => ', e));
}, []);
return (
<Image style={{height: 200, width: 200}} source={{uri: imageUrl}} />
);
}
export default Photos;
【问题讨论】:
标签: javascript firebase react-native firebase-storage