react-navigation TabNavigator仅渲染第一个选项卡

时间:2018-02-03 22:40:18

标签: react-native react-navigation react-native-ios

我正在开发react-native应用程序,我使用TabNavigator(react-navigation),2个简单的Tabs包含登录屏幕(两个选项卡都有相同的屏幕)。第一个选项卡始终显示,但第二个选项卡不会显示。

我看到没有错误。 我在ios模拟器(iPhone x,ios 11)上运行它

const LoginStack = StackNavigator({
    Login: {
        screen: SignIn,
        navigationOptions: {
            title: 'Sign In' //strings('screens.SignIn.title'),
        },
    },
}, {
 headerMode: 'screen',
});

export const SignedInTabs = TabNavigator
  Orders: {
      screen: LoginStack, //OrdersStack,
        navigationOptions: {
            tabBarLabel: 'login', //strings('tabs.Orders'),
            tabBarIcon: ({tintColor}) => ( <Icon name = "list" color = {tintColor} size = {28} />),
        },
  },
  Account: {
        screen: LoginStack,
        navigationOptions: {
            tabBarLabel: 'login', //strings('tabs.Account'),
            tabBarIcon: ({tintColor}) => ( <Icon name = "account-circle" color = {tintColor} size = {28} />),
        },
  },
 }, {
    tabBarPosition: 'bottom',
    tabBarComponent: TabBarBottom,
    tabBarOptions: {
        activeTintColor: '#FFF',
        activeBackgroundColor: colors.primaryTheme
    },
});

react-native version:0.51.0

react-navigation version:1.0.0-beta.27

节点版本:6.11.0

npm版本:3.10.10

1st tab shows up well

2nd tab didn't show up

编辑(5月26日至18日):

https://github.com/react-navigation/react-navigation/issues/1627#issuecomment-368323254

robvolk评论解决了我的问题。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。看起来它是最新反应导航版本的一个错误?根据这个帖子(https://github.com/react-navigation/react-navigation/issues/3586),降级到react-navigation@1.0.3将解决问题。我降级并成功解决了这个问题。

我在这个头发上撕了2天。

相关问题