【发布时间】:2018-07-26 12:23:11
【问题描述】:
我想在本机反应中加载图像。我浏览过很多帖子,但几乎每篇帖子都谈到将图片的静态/本地 url 指定为来源。但是,我想将其指定为
src= {this.state.url}
this.state.url 在代码中被分配了一个动态 url(来自 google 图片)。
有可能吗?
【问题讨论】:
-
你绝对可以在 React Native 中使用外部图像,例如
<Image source={{ uri: 'https://example.com/image.png' }} />,但要求图像不能是动态的,因为 React Native 必须知道在最终构建中要捆绑哪些图像。
标签: image react-native url dynamic native