0

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

Kimako
  • 615
  • 2
  • 11
  • 26

1 Answers1

1
imageStyle={{ resizeMode: 'cover' }}

or

imageStyle={{ resizeMode: 'stretch' }}
D10S
  • 1,468
  • 2
  • 7
  • 13
  • 1
    Even though it was down-voted (by someone that his answer did not help) it is the answer you are looking for. – D10S Aug 18 '20 at 06:41
  • I tried to change resizeMode stretch / cover /contain/center, even removing height and width, nothing happens. – Kimako Aug 18 '20 at 06:42
  • 2
    Look at my answer. It is inside the "imageStyle" prop, not the "style" prop – D10S Aug 18 '20 at 06:46
  • You are welcome. Please mark it as useful for future generations (it is currently marked not useful as someone down-voted) – D10S Aug 18 '20 at 06:56