Reputation: 24731
In CSS, if you set a width of 60%, the height will proportionally adjust. In React Native, that is not the case. If you set the width of an image to be '60%'
, and don't set the height, the height will be 0 and not show. How do I get the height to do the same as CSS?
thumbnail: {
width: '60%',
minHeight: 10,
}
I tried setting a minHeight, and that makes it go to 10px. I want the height to change based on the image proportions. I looked at flex, but I don't think that's what I want.
Upvotes: 3
Views: 635
Reputation: 1177
I think you want to set the resizeMode to contain
. It could be cover
, it looks like there's currently a mistake in the docs... https://facebook.github.io/react-native/docs/image.html
Upvotes: 1