0

I have:

<Card>
  <Card.Cover source={{ uri: props.source.uri }}
              resizeMode={`cover`} style={{flexDirection: 'column'}}/>
  <Card.Content>
    {/* <Title>Card title</Title> */}
    <Text>Card content</Text>
  </Card.Content>
</Card>

And am trying to scale the Card.Cover so that each card is not the same height - but rather it depends on the image dimensions. Currently, all of the cards have the same height and width. How can I do this?

Shamoon
  • 41,293
  • 91
  • 306
  • 570

1 Answers1

2

Maybe you could use

Image.getSize(uri, success, [failure]);

to get and set the height? Image.getSize

Or you could try like this:

Image.resolveAssetSource(require("uri")).height

In your code

<Card.Cover source={{ uri: props.source.uri }} resizeMode={`cover`} style={{flexDirection: 'column',height:Image.resolveAssetSource(require(props.source.uri)).height}}/>
高鵬翔
  • 1,997
  • 2
  • 8
  • 21