react native 安卓中headerTitle居中对齐
在navigationOptions配置如下
static navigationOptions = ({navigation}) => {
return {
headerTitle:'储能选择',
headerStyle: {
backgroundColor: '#42b0fc',
alignItems:'center'
},
headerTitleStyle: {
flex:1,
textAlign: 'center'
//alignSelf: 'center'navigation3.0版本以下可以直接用这个,3.0以上用上面两句代码
},
headerRight: (
<View/>//如果有返回按钮,加上一个View标签,才能使headerTitle居中
),
};
};