react-native - React Native从firebase存储下载多个图像
问题描述
我有这段代码,我在其中下载了渲染项中的照片,然后将它们显示在屏幕上,当我显示单个图像时它可以正常工作,但是当我尝试显示多个图像时,会创建无限查询循环并且应用程序停止在职的。渲染项显示在平面列表中
const [imageUrl, setImageUrl] = useState(undefined);
const renderItem = ({item}) =>{
let correo = item.correo;
storage
.ref(item.correo+"/"+ item.titulo)
.getDownloadURL()
.then((url) => {
setImageUrl(url);
console.log(url);
})
.catch((e) => console.log('Errors while downloading => ', e));
return(
<Image
source={{ uri: imageUrl }}
style={{
width: 113,
height: 99,
borderTopLeftRadius: 10,
borderBottomLeftRadius: 10,
}}
/>
)
}
解决方案
推荐阅读
- java - HashMap Java 的搜索键和增量值
- javascript - Tensorflow.js 请确保使用变量的操作在传递给minimize()的函数f内
- node.js - 查询 Mongodb 适用于终端但不适用于节点 js
- f# - 获取一条指令抛出的最后一条错误消息
- scala - 如何在 Spark Shell 中映射三个不同类型的元素?
- c++ - 使用 fstream 从 txt 文件中循环数字
- sql - SQL Server - INSERT 语句与 FOREIGN KEY 约束冲突
- react-native - 反应导航警告:“jumpToIndex 不是函数”
- r - R:编写一个返回向量的两阶段函数
- php - Godaddy 的问题 - AWS WordPress 网站