React Native background image - cover and vertical align to top

2.2k views Asked by At

I am looking for a way to add a background image in React Native that would be styled equivalent to HTML's:

background-size: cover;
background-position: top center;

I am using ImageBackground and resizeMode="cover" but the image is vertically aligned to middle and I cannot get it to be aligned to top. Is there a prop that would allow setting vertical alignment/position in React Native?

resizeMode="strech" won't work for my case because the background image contains a logo that must not be distorted.

The image size is 1242 x 2436 to allow full height cover even on iPhone X. The logo is located on 1/6 top part of the image and must always be visible, bottom can be hidden depending on the device height and orientation, image must always be full width of the screen.

0

There are 0 answers