Problem when use dynamic value with image component react native

前端 未结 2 938
情话喂你
情话喂你 2021-01-26 18:21

I get data from DB and put it into source image, it will be error, but if i put only string it will run ok

Run ok:

2条回答
  •  花落未央
    2021-01-26 19:14

    You need to require the source in the array so that React Native can display your images dynamically. In carOfPerson array requires the link to the images

    instead of ['img1', 'img2'], you will have [require('img1'), require('img2')]

提交回复
热议问题