如何动态更新所有标签导航标题?

时间:2019-03-18 12:44:48

标签: react-native react-navigation react-native-tabnavigator

我有3个标签Tab1,Tab2和Tab3。如何动态更改任何标签页的此标签页标题。

下面是我的代码。

const TabNav = createBottomTabNavigator(
    {
        TabName1: {
            header: null,
            screen: StackNav1,
            navigationOptions: ({ navigation }) => ({
                title: 'Tab1',
                header: null,
                tabBarIcon: ({ tintColor }) => {
                    return;
                }
            })
        },
        TabName2: {
            header: null,
            screen: StackNav2,
            navigationOptions: ({ navigation }) => ({
                title: 'Tab2'
            })
        },
        TabName3: {
            screen: StackNav3,
            navigationOptions: ({ navigation }) => ({
                header: null,
                title: 'Tab3'
            })
        }
    },
    {
        initialRouteName: "TabName1",
        tabBarPosition: "bottom",
        headerMode: "none",
        swipeEnabled: false,
        animationEnabled: false,
        lazy: true,
        removeClippedSubviews: true,
        order: ["TabName1", "TabName2", "TabName3"],
        backBehavior: "initialRoute",
    }
);

请帮助我如何动态更改标签标题。

谢谢

0 个答案:

没有答案