1

我有 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",
    }
);

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

谢谢,

4

0 回答 0