2017-07-26 157 views
3

努力了解如何更改导航标题栏背景颜色。 我使用反应导航和世博会来建立我的应用程序。更改导航标题背景颜色

backgroundColor似乎没有做任何事情。任何想法如何做到这一点?

我的代码如下:

static navigationOptions =() => ({ 
    title: 'My App', 
    headerTintColor: Colors.DarkBlue, 
    backgroundColor: 'red', 
    headerLeft: 
     <HeaderBarItem to='InfoScreen' title='App info' />, 
    headerRight: 
     <HeaderBarItem to='FeedbackScreen' title='Feedback' /> 
    }); 

回答

5

这应该工作:

static navigationOptions =() => ({ 
 
    title: 'My App', 
 
    headerTintColor: Colors.DarkBlue, 
 
    headerStyle: { 
 
     backgroundColor: 'red' 
 
    }, 
 
    headerLeft: 
 
     <HeaderBarItem to='InfoScreen' title='App info' />, 
 
    headerRight: 
 
     <HeaderBarItem to='FeedbackScreen' title='Feedback' /> 
 
    });

+0

超级开始非常感谢你:) – Led

+0

@Aakash哪里呢这个Colors.DarkBlue和

+1

这些只是来自问题@JP的组件和变量 –