В моем приложении React Native есть следующий экран: ![enter image description here](https://i.stack.imgur.com/F5bj0.png)
Черно-синий фон ImageBackground
, а зеленая полоса посередине - View
. Код:
<ImageBackground
source={require('@images/login-background.jpg')}
style={{
flex: 1,
width: '100%',
resizeMode: 'cover',
justifyContent: 'center',
}}
>
<View style={{
width: '100%',
backgroundColor: 'green',
borderRadius: 15,
padding: 15
}}/>
</ImageBackground>
Я хочу, чтобы на левом и правом краях зеленого цвета View
было 15px
отступов. Если бы ImageBackground
было View
, я бы добавил 15px
отступа к нему, но когда это ImageBackground
, это приводит к:
И наоборот, если я добавлю margin: 15px
к зеленому View
, я получу это:
![enter image description here](https://i.stack.imgur.com/iAFJU.png)
Как мне подойти это, чтобы это выглядело так?
![enter image description here](https://i.stack.imgur.com/pVpcv.png)