【问题标题】:Is it possible to show tab bar in a screen but the screen does not appear in the tab bar?是否可以在屏幕中显示标签栏但屏幕不会出现在标签栏中?
【发布时间】:2017-07-11 13:10:12
【问题描述】:

让我有三个屏幕。

  1. 首页
  2. 简介
  3. 设置

当应用程序启动时,主屏幕将显示两个选项卡(配置文件和设置)。我已将 react-navigation 用于选项卡导航器。单击“个人资料”选项卡时,将显示个人资料屏幕,如果单击“设置”选项卡,则将显示“设置”屏幕。

【问题讨论】:

    标签: react-native react-navigation


    【解决方案1】:

    您可以将导航对象添加到另一个作为屏幕。我尝试根据您的需要创建示例代码

    const HomeScreen = createTabNavigator({
      HomeScreen: { 
        screen: HomeScreen,
        navigationOptions: {
            header: null,
            tabBarLabel: 'Profile',
            tabBarOnPress: ({ navigation }) => {
                   navigation.navigate('Profile')  
            }
        }
      },
      Settings: { 
        screen: Settings,
        navigationOptions: {
            header: null
        }
      },
    
    
    
    },
    
    {
        initialRouteName: 'HomeScreen',
        lazy: true,
    })
    const HomeScreen = createStackNavigator({
      Profile: { 
        screen: Profile,
        navigationOptions: {
            header: null
        }
      },
      Home: { 
        screen: Home,
        navigationOptions: {
            header: null
        }
      },
    
    
    
    },
    
    {
        initialRouteName: 'Home',
        lazy: true,
    
    
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-25
      • 1970-01-01
      • 1970-01-01
      • 2021-11-10
      • 2012-01-20
      • 1970-01-01
      • 2022-11-09
      • 2011-03-30
      相关资源
      最近更新 更多