It works if I show the image like this:
<Thumbnail source= {require('../images/01.jpg')} />
But fails on :
<Thumbnail source= {require('../images/'+ {person.id} +'.jpg')} />
person.id
comes from an array of people
. Printing it in <Text>{person.id}</Text>
gives the output as 01
or 02
.
How to show a local image with the name as the prop.value?
I tried:
<Thumbnail source= {require(`../images/${person.id}.jpg`)} />
and
<Thumbnail source= {require('../images/'+ person.id +'.jpg')} />
Both fails with error : Unnamed named module: '../images/1.jpg'