Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to dynamically set react-native image source inside flat list

$
0
0

I'm new to react native i'm trying to populate flat list with images. All the images are stored inside the app. I want to set image source dynamically in every iteration. This is what I tried. Please help me.

<FlatList  data={this.state.listData}  renderItem={({ item }) => {<Image                                                                 source={    (item)=>{     switch(item.TypeX){     case '1':     return require('path 1');     case '2':     return require('path 2')   }}} />  }</FlatList>

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>