Reputation: 1785
{this.state.items.map((item) => (
<View style={{height:10, padding:10}}>
<Image
style={{flex:1, width: null, height: null, borderRadius:10}}
source={require(`${item.imagem}`)}
/>
</View>
)
)}
I cant to set the source > require > argument using a data map
bundling failed: Error: calls to
require
expect exactly 1 string literal argument, but this was found:require("" + item.codigo)
.
Upvotes: 0
Views: 76
Reputation: 2537
This is not possible.
You should generate a massive switch-case statement to require what you want or use a babel plugin
You can check more details here:
Upvotes: 1