i need to show the images on my screen with the element flatlist
const renderItem = ({ item }) => (
<ImageBackground
source={{ uri: item.imageUrl }}
imageStyle={{
borderRadius: 6,
resizeMode: 'contain'
}}
/>
);
return (<FlatList data={coursesData} renderItem={renderItem} keyExtractor={(item) => item.id} />);
CodePudding user response:
I see a few issues:
- Why are you using ImageBackground instead of just Image? ImageBackground is intended for use as a background.
- If the source of your image is a url you must specify an image height and width.
- give Flatlist style={{ flex: 1 }}, this will allow it to take up all the space it needs.
