StackNavigator:无法更改 header 标题的字体颜色
StackNavigator: Not able to change font color for the header title
我正在尝试将标题字体的颜色从黑色更改为白色。做不到。我在代码中有以下内容:
navigationOptions: {
title: 'PRACTICIA',
headerLeft: null,
headerStyle: {
backgroundColor: '#33ACDE',
color: 'white'
}
}
}
我得到以下结果(黑色)。
headerStyle
中定义的样式将应用于 header <View />
。
要将样式应用于标题,您必须按照 StackNavigator documentation 中所述使用 headerTitleStyle
。
navigationOptions: {
title: 'PRACTICIA',
headerLeft: null,
headerStyle: {
backgroundColor: '#33ACDE'
},
headerTitleStyle: {
color: 'white'
}
}
我正在尝试将标题字体的颜色从黑色更改为白色。做不到。我在代码中有以下内容:
navigationOptions: {
title: 'PRACTICIA',
headerLeft: null,
headerStyle: {
backgroundColor: '#33ACDE',
color: 'white'
}
}
}
我得到以下结果(黑色)。
headerStyle
中定义的样式将应用于 header <View />
。
要将样式应用于标题,您必须按照 StackNavigator documentation 中所述使用 headerTitleStyle
。
navigationOptions: {
title: 'PRACTICIA',
headerLeft: null,
headerStyle: {
backgroundColor: '#33ACDE'
},
headerTitleStyle: {
color: 'white'
}
}