Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageBackground doesn't accept ResizeMode

Tags:

react-native

Anyone here can help me make resizeMode work with <ImageBackground>?

It gives an error that resizeMode is applied to View, which apparently doesn't support it.

But i need to find a workaround, as i find pretty complicated to use <Image /> as a background for a block with info.

Thanks in advance!

like image 897
Ziya Avatar asked Dec 14 '25 17:12

Ziya


1 Answers

<ImageBackground 
  style={[styles.image]} 
  source={{ uri: url }} 
  imageStyle={{resizeMode: 'contain'}}
>
  // other components here
</ImageBackground>

Hope it helps!

like image 189
Cong Dan Luong Avatar answered Dec 16 '25 21:12

Cong Dan Luong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!