简体   繁体   English

反应式图像背景

[英]Image Background in Reactnative

I am working on a react native project I want to set an image as the background for full screen but I am unable to resolve the header issue I am using the component "ImageBackground" for setting the image. 我正在做一个React Native项目,我想将图像设置为全屏背景,但是我无法解决标题问题,我正在使用组件“ ImageBackground”来设置图像。 I want the image for full screen. 我想要全屏显示图像。 can someone help me with that? 有人可以帮我吗?

thanks 谢谢

无法解析标题

  • In your case ImageBackground should be most parent view of all the views here. 在您的情况下, ImageBackground应该是此处所有视图的大多数父视图。 It seems like your toolbar is wrapped with ImageBackground or with its parent. 看来您的工具栏是用ImageBackground或其父级包装的。
  • Another reason can be possible if your Toolbar has an white background, then how will this image be visible. 如果您的Toolbar背景为白色,则可能是另一个原因,那么该图像将如何显示。 So make Toolbar transparent. 因此,使Toolbar透明。

It's seems you are using React-navigation , if so, you can modify your StackNavigator to not display the header: 看来您正在使用React-navigation ,如果是这样,则可以修改StackNavigator以不显示标题:

createStackNavigator({
  PageName: { screen: PageName },
  // all your routes
},
{
  headerMode: 'none', --> here
})

You will find more informations in the react-navigation doc 您可以在react-navigation文档中找到更多信息

Thanks, Everyone for your time to answer I have solved the issue by adding some styles to my image and also making the header to null. 谢谢,大家花时间回答我,通过在图像中添加一些样式并将标头设置为null来解决了该问题。

static navigationOptions={
header:null
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM