I am trying to do the following:
var itemImage = '../img/image1.jpg'
return(
<Image
source={require(itemImage)}
/>
but it keeps saying the error:
Requiring unknown module '../img/image1.jpg'.
But when I directly put in: '../img/image1.jpg' inside require() then it works.
What may be the issue? Any guidance or insight would be appreciated.
EDIT ***
I have the following in my constructor as my dataSource:
this.state = {dataSource: ds.cloneWithRows([{name: '../img/item1.jpg'}, {name: '../img/item2.jpg'}])}
then in my renderRow(), I am trying to achieve something like the following so it updates based on the dataSource:
renderRow(rowData){
var itemImage = require(rowData.name)
return(
<Image
source={itemImage}
/>
But I am still getting the same error:
Requiring unknown module '../img/image1.jpg'.