如何为本地存储的反应原生图像传递道具

时间:2018-01-09 17:49:51

标签: image react-native local react-props react-image

我试图通过一个道具来满足'要求'在反应原生组件的IMAGE标签中。但是,它显示错误"服务器代码错误500"。如果我使用URI传递一个链接它也适用于道具。

工作:

<Image
        style={{ width: 70, height: 61 }}
        source={{ uri: imgCode }}
      />


imgCode="https://i.imgur.com/edgLzLO.png"

需要修复:

<Image
          style={{ width: 70, height: 61 }}
          source={require('./images/header_arrow.png')}
        />

imgCode="./images/batter_logo.png"

1 个答案:

答案 0 :(得分:0)

<Image
    style={{ width: 70, height: 61 }}
    source={require({ uri: imgCode })}
  />


imgCode="https://i.imgur.com/edgLzLO.png"

试试这个 可能有用