// 加载headerTitle
TabsNavigator.navigationOptions = ({ navigation }) => {
const { routeName } = navigation.state.routes[navigation.state.index];
// You can do whatever you like here to pick the title based on the route name
const headerTitle = routeName;
return {
headerTitle
};
};
这样每个tab中的screen中的headerTitle都可以显示出来了~
同样的 headerBackTitle也可以同样的设置:
// 加载headerTitle
TabsNavigator.navigationOptions = ({ navigation }) => {
const { routeName } = navigation.state.routes[navigation.state.index];
// You can do whatever you like here to pick the title based on the route name
const headerTitle = routeName;
const result = {
title: headerTitle,
headerBackTitle: null
};
return result;
};
其实相当于tab才是控制header上的control 通过对tab中的screen的navigationOptions进行读取后来间接将对应的配置生效