React Native - Image Require Module using Dynamic Names

前端 未结 14 1071
夕颜
夕颜 2020-11-22 11:29

I\'m currently building a test app using React Native. The Image module, thus far has been working fine.

For example, if I had an image named avatar, th

14条回答
  •  一生所求
    2020-11-22 12:04

    You should use an object for that.

    For example, let's say that I've made an AJAX request to an API and it returns an image link that I'll save to state as imageLink:

    source={{uri: this.state.imageLink}}

提交回复
热议问题