如何在React Native中显示来自Firestore数据库的图像数组? [英] How to display an array of images from the firestore database in react native?

查看:84
本文介绍了如何在React Native中显示来自Firestore数据库的图像数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,如何在react native中显示来自Firestore数据库的图像数组?我尝试过此操作,但没有图像显示

hello how to show an array of images from the firestore database in react native? i tried this but no images are showing

{this.props.user.map((images)=>{
return (
  <View>
    <Image style={ {width: 350, height: 300}} source={{uri: images.photos}} />
  </View>
);
})}

我在屏幕底部以黄色显示此警告

i am getting this warning at the bottom of the screen in yellow

''警告:道具类型失败:提供给'ForwardRef(image)'的道具'来源'无效''

''Warning: Failed prop type: Invalid prop 'source' supplied to 'ForwardRef(image)' ''

推荐答案

我相信您没有在源uri中提供图像的正确路径.您能先检查一下邮递员,images.photos是哪种数据类型?并且如果它不是图像的URL,则本机响应将不会呈现.始终将图像存储为images.photos.uri,以便于澄清.顺便说一句,如果images.photos是一个url数组,那么React Native不会渲染.您需要将每个uri传递给每个图像标签,并且您可以做的是在另一个map函数中迭代图像,以便对每个图像进行迭代.

What I believe is you are not giving the proper path of the image in source uri. Can you first check in postman that what kind of data type is images.photos? And if it's not an url for the image, react native won't render. Always store your images as images.photos.uri for easy clarification. And by the way if images.photos is an array of url, then react Native won't render. You need to pass each uri to each image tag, and what you can do is iterate images in another map function so that each image is iterated.

这篇关于如何在React Native中显示来自Firestore数据库的图像数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆