React Native 从 Firebase 存储下载多个图像

时间:2021-06-05 00:31:52

标签: react-native firebase-storage

我有这段代码,我在其中下载渲染项中的照片,然后将它们显示在屏幕上,当我显示单个图像时效果很好,但是当我尝试显示多个图像时,会创建无限查询循环,并且该应用程序停止工作。渲染项显示在一个平面列表中

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,
     }}
   />
)
}

0 个答案:

没有答案