2017-07-26 158 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的組件和變量 –