Beginner with React Native here.
I'm working on a small App which needs to display an image according to a random number. For exemple if I got 203, I want to display the image Project/img/203.png (random number is between 1 and 726)
The first thing I tried was require(dynamicPath), after reading documentation I understood that was not a good way to do it and I don't want to require each 726 image staticly. Then I tried with the uri syntax :
//Executed from Project/components/ folder
loadImage(number){
imgUri = '../img/'+number.toString()+'.png'
return(
<Image source={{uri: imgUri}} />
)
The application does launch but there is no image displayed (even with height/width style set). Examples I had seen with uri syntax were about images recieved from a web URL so I'm not sure it allows to get it from a local storage, but i can not find another way to get the image.