我在React Native中使用了react-navigation
,并且我用以下命令更改了标题颜色
const MyScreenNavigator = StackNavigator({
...
}, {
navigationOptions: {
headerStyle: {
backgroundColor: 'blue',
},
headerTintColor: 'white'
}
});
它确实改变了页眉和状态栏的背景颜色,但状态栏中的字体颜色仍然是黑色。
如何自定义状态栏的字体颜色?
发布于 2017-12-05 03:45:25
我使用StatusBar
const RootNavigator = StackNavigator({
...
}, {
initialRouteName: 'Home',
navigationOptions: {
header: <Header />
}
});
header.js
import { StatusBar } from 'react-native';
export default class Header extends Component<{}> {
<View>
<StatusBar backgroundColor="#fff" />
...
</View>
}
发布于 2017-05-22 18:31:47
应用程序接口和文档仍然经常更改,但为了样式化StackNavigator's报头,请使用headerTitleStyle: { color: 'white' }
。(https://reactnavigation.org/docs/navigators/stack#headerTitleStyle)
发布于 2017-08-16 16:57:11
我相信你现在还不能用navigationOptions改变状态栏的背景颜色。您应该在组件中使用StatusBar:
<StatusBar
barStyle="light-content"
backgroundColor='blue'
/>
https://stackoverflow.com/questions/44118063
复制相似问题