在TabNavigator的选项卡之间切换时,所有选项卡都在安装

时间:2017-10-27 15:48:02

标签: reactjs react-native react-navigation

从第一个标签切换到第二个标签后显示控制台:

enter image description here

发生时,上一个标签的状态未保存,转换到下一个标签的速度很慢

我的route config

const NestedStack1 = StackNavigator({
    Tab1Page1: { screen: Tab1Page1 },
},{
    navigationOptions: {
        headerMode: 'screen'
    }
});

const NestedStack2 = StackNavigator({
    Tab2Page1: { screen: Tab2Page1 },
},{
    navigationOptions: {
        headerMode: 'screen'
    }
});

const ProfileScreenStack = StackNavigator({
    ProfileScreen: { screen: ProfileScreen },
},{
    navigationOptions: {
        headerMode: 'screen'
    }
});

export default TabNavigator({
    Tab1: { screen: NestedStack1 },
    Tab2: { screen: NestedStack2 },
    Tab3: { screen: Tab3 },
    Tab4: { screen: Tab4 },
    ProfileScreen: { screen: ProfileScreenStack }
},{
    tabBarOptions: {
        showLabel: false,
        activeTintColor: c.BLACK
    }
});

如何修复标签的更新?切换应该快速保存状态

0 个答案:

没有答案