Card Image dooesn't showing properly.
Here is my code:
<Card key={item['id']} >
<CardItem cardBody>
<Image
source={{uri: item['image']}}
style={{
alignSelf: 'stretch',
resizeMode: 'contain',
width: Dimensions.get('window').width,
marginRight: 10,
}}
/>
</CardItem>
<CardItem footer>
<Text>Title</Text>
</CardItem>
</Card>
Its not working properly i.e: no image is being shown. Any idea what am I missing?
Same issue
<Card>
<CardItem cardBody>
<Image source={require('../images/test.jpg')} style={{ resizeMode: 'cover', height: 200, width: null, flex: 1 }} />
</CardItem>
</Card>
@rithvikvibhu @tishad770 the above should work for you guys .try it out
@GeekRishabh thanks for that. What about external images?
source={{uri:'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'}} used to work with any url for an image.
I had a similar issue just now. The image, when placed inside a Card with a height of 180, will render on the simulator, but not on the device.
<Card>
<CardItem cardBody>
<Image
source={item.thumbnail}
style={styles.thumbnail}
/>
</CardItem>
<CardItem note>
<Grid>
<Row>
<Text>{item.name}</Text>
</Row>
<Row>
<Text>{item.description}</Text>
</Row>
</Grid>
</CardItem>
</Card>
const styles = StyleSheet.create({
thumbnail: {
flex: 1,
height: 180 // Changed this to >200
}
});
Changing the height to anything larger than 200 fixed the issue. It renders fine on both now, the simulator and the device. 😕
I also had several rendering issues with Card on devices, and I just ended up replacing all of them with custom styled view.
There are many issues with the card item. For example: https://github.com/GeekyAnts/NativeBase/issues/612
I also changed to use custom styled views.

@tishad770 @rithvikvibhu @ferdingler @ishsingh @Anima-t3d Works fine. Tried with device as well, all good If both width and height is included for the Image.
You need to check the note mentioned in the docs of React Native for Image
@rithvikvibhu Yes external images still works with Image