navigationOptions 配置隐藏标题栏和实现标题居中
2019-04-14 本文已影响0人
前端来入坑
import { Platform } from "react-native";
const TITLE_OFFSET = Platform.OS === 'ios' ? 70 : 56;
......
...隐藏标题栏
Home: {
screen: Example ,
navigationOptions: {
header: null
}
},
...标题栏的居中显示
Test: {
screen: Example,
navigationOptions: {
title: 'test',
headerTitleStyle:{
textAlign: 'center',
flex:1,
},
headerTitleContainerStyle:{
left: TITLE_OFFSET,
right: TITLE_OFFSET,
}
}
}

