Kimako
Kimako

Reputation: 625

Image doesn't fit in screen React-native

I have an imagebackground that's working but exceeds in height, I don't know how to make it fit to the screen. In fact, it 'cuts' the top of the image.

The original image :

enter image description here

my code :

  <ImageBackground
source={require("../../assets/images/background-stats.jpg")}
style={{flex: 1,
width: "100%",
height: "100%",
resizeMode: 'contain',
justifyContent: 'center'
}}

the result : enter image description here

Upvotes: 0

Views: 456

Answers (1)

D10S
D10S

Reputation: 1549

imageStyle={{ resizeMode: 'cover' }}

or

imageStyle={{ resizeMode: 'stretch' }}

Upvotes: 1

Related Questions