如何在本机与array.map一起显示来自URL的图像?

时间:2019-06-17 16:48:45

标签: image react-native url

我使用在线https://github.com/nathvarun/React-Native-Layout-Tutorial-Series/blob/master/Project%20Files/12%20Tinder%20Swipe%20Deck/%232%20Complete%20Animation/App.js上找到的这段代码 我想将此代码与图片网址一起使用。当我在用户数组中更改第一个uri时出现的问题:“ https://URL”。我没有发现错误,但图像未显示。

const Users = [
      { id: "1", uri: 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'},
  { id: "2", uri: require('./assets/2.jpg') },
  { id: "3", uri: require('./assets/3.jpg') },
  { id: "4", uri: require('./assets/4.jpg') },
  { id: "5", uri: require('./assets/5.jpg') },
]    

My whole code is too long but above is change, the other code is the as in github. 

1 个答案:

答案 0 :(得分:0)

<Image source/>属性需要一个类似{ uri: 'https://' }的对象,而不是字符串。您可以here来了解它。