在 React Native 中使用地图功能时不显示图像

image is not displaying while using a map function in react native

我已经硬编码了一些数据并做了一个映射来获取我数组的所有数据, 除我的图像外,所有数据都在显示。 我尝试了几种解决方案,但没有任何效果。 当我在字符串中使用带有图像路径的 require 时,它​​正在工作,但我找不到显示不同图像的方法 有什么想法吗?

var articleData = [
    { name: "Textile motorcycle jacket", brand: "Dainese", img: "../assets/Jacket.jpg", price: '200' },
    { name: "Summer motorcycle gloves", brand: "Furygan", img: "../assets/summer_gloves.jpg", price: '30' },
    { name: "Winter motorcycle gloves", brand: "Triumph", img: "../assets/winter_gloves.jpg", price: '70' },
    { name: "Motorcycle boots", brand: "BMW", img: "../assets/boots.jpg", price: '180' },
    { name: "Goretex / waterproof pants", brand: "Dainese", img: "../assets/pants.jpg", price: '150' },
    { name: "Back and safety protection", brand: "Dainese", img: "../assets/back_protection.jpg", price: '100' },
  ]

  var ArticleList = articleData.map((article, i) => {
    return (<View  style={{ width: '47%', margin: 5 }}>

      <Image source={{uri: article.img}}  style={{ height: 250, width: 200}} />
      <View style={{ flex: 1, flexDirection: 'row', marginTop: 5, justifyContent: "space-between" }}>
        <Text style={{ fontWeight: 'bold' }}>{article.brand}</Text>
        <FontAwesome name="heart" size={20} color={colorLike} />
      </View>
      <Text>{article.name}</Text>
      <Text>{article.price}€</Text>
    </View>
    )
  }
  )

您可以使用'require'

 <Image source={require(article.img}  style={{ height: 250, width: 200}} />

你可以尝试像这样在文章数据中添加要求

 { name: "Textile motorcycle jacket", brand: "Dainese", img: require("../assets/Jacket.jpg"), price: '200' }