I'm trying to generate a random card image - depending on the string returned from this.generateRandomCard - but I'm getting the following error:
"Requiring unknown module "./card_images/7S.png". If you are sure the module is there, try restarting the packager or running "npm install".
Note: Using require('./card_images/7S.png') works.
Here is my code:
render: function() {
var card = require('./card_images/' + this.generateRandomCard() + '.png');
return (
<View>
<Text>{this.generateRandomCard()}</Text>
<Image source={card}/>
</View>
);
}
Thanks for the help!