右对齐背景图片

Right align background image

我正在尝试使用 React Native 实现相同的效果:

{
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  position: absolute;
  background: center right no-repeat;
  background-size: contain;
  background-image: url(/static/media/background.png);
}

到目前为止我可以使图像与屏幕中心对齐,但不是在右边(因为不能使用相同的属性)。

先读这个 https://facebook.github.io/react-native/docs/flexbox.html#flex-direction

float 属性 在 React Native 中不存在,但是有很多选项可供您使用(行为略有不同)可以让您右对齐 text/Image(阅读上面的文档 link)。

现在让我们回到您的答案。 您可以直接指定项目的对齐方式,例如:

textright: {    
  alignSelf: 'flex-end',  
},