将堆栈导航器的标题更改为活动选项卡routeName?

时间:2019-02-22 06:32:43

标签: react-native react-navigation

我在堆栈下有两个标签:

const AppStack = createStackNavigator(
  {
    Home: {
      screen: createBottomTabNavigator(
        {
          Home: {
            screen: TodosScreen,
            navigationOptions: ({ navigation }) => ({
              title: navigation.state.routeName
            })
          },
          Profile: {
            screen: ProfileScreen,
            navigationOptions: ({ navigation }) => ({
              title: navigation.state.routeName
            })
          }
        },
        {
          initialRouteName: 'Home',
        }
      ),
      navigationOptions: ({ navigation }) => {
        console.log('navigation = ', navigation.state);
        return {
          title: navigation.state.routeName
        };
      }
    }
  }
);

我正在考虑根据底部标签导航器路线名称更改stacknavigators标题?这怎么可能实现?

0 个答案:

没有答案