我完全困惑要实现以下内容,这工作正常,但无法隐藏EditPage和PageTwo的标签栏

  • 登录
  • 注册
  • TabNavigator(TabNavigator)
  • FirstTab
  • SecondTab(StackNavigator)
  • ListPage
  • EditPage
  • ThirdTab(StackNavigator)
  • PageOne
  • PageTwo
  • 设置

  • 下面是我的配置。

    import { createStackNavigator, createSwitchNavigator, createBottomTabNavigator } from 'react-navigation';
    //Other required imports here
    
    const SignedOut = createStackNavigator({
      Signup: { screen : Signup},
      Login: { screen : Login}
    });
    
    const SignedIn = createBottomTabNavigator({
        Dashboard: {
          screen: Dashboard
        },
        Rewards: {
          screen: createStackNavigator({
            Rewards:{
              screen: Rewards,
              navigationOptions:{
                header:null
              }
            },
            AddReward:{
              screen: AddReward,
              navigationOptions:{
                header:null,
                tabBarVisible: false
              }
            }
          })
        },
        Activities: {
          screen: createStackNavigator({
            Rewards:{
              screen: Activities,
              navigationOptions:{
                header:null
              }
            },
            NewActivity:{
              screen: NewActivity,
              navigationOptions:{
                header:null,
                tabBarVisible: false
              }
            }
          })
        },
        Settings: {
          screen: Settings
        }
    },{
      tabBarComponent: ({navigation}) => <FooterComponent navigation={navigation} />,
      tabBarPosition: 'bottom',
      animationEnabled: false,
      swipeEnabled: false
    });
    
    export const createRootNavigator = (signedIn) => {
        return createSwitchNavigator(
            {
                SignedIn: {
                    screen: SignedIn
                },
                SignedOut: {
                    screen: SignedOut
                }
            },
            {
                initialRouteName: (signedIn) ? "SignedIn" :"SignedOut",
                headerMode: 'none'
            }
        );
    };


    问题
  • 我无法隐藏 AddReward NewActivity
  • 的标签栏
  • tabBarVisible: false在TabNavigator内的StackNavigator中不起作用

  • 谢谢

    最佳答案

    您可以在所有堆栈中使用一个StackNavigator,并将TabNavigator设置为默认路由:

  • SwitchNavigator
  • 登录
  • 注册
  • StackNavigator
  • TabNavigator
  • FirstTab
  • ListPage
  • 设置
  • EditPage
  • PageTwo
  • 10-04 22:19