简体   繁体   English

如何在堆栈导航器中嵌套底部标签栏?

[英]How can I nest a Bottom Tab Bar inside a stack Navigator?

I am trying to nest a tab navigator inside my stack navigator but I am not sure how to approach this issue so I am asking you.我试图在我的堆栈导航器中嵌套一个选项卡导航器,但我不确定如何解决这个问题,所以我问你。 I have read a bit and still haven't found a proper way to tackle this question.我已经阅读了一些内容,但仍然没有找到解决这个问题的正确方法。

Here's some code:这是一些代码:

import { createAppContainer, createBottomTabNavigator } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';

const RootStack = createStackNavigator(
  {
    Home: LoginForm,
    Feed: NewsDetail,
    Unique: NewsUniquePage
  },
  {initialRouteName: 'Feed',
   defaultNavigationOptions: {
    headerStyle:{
      backgroundColor: 'white',
    },
    headerTintColor: 'black',
    headerTitleStyle:{
      textAlign: 'center',
      flex: 1
    }
  }},
);

const AppContainer = createAppContainer(RootStack)

I have got more code although this is the only chunk of code related to navigation.尽管这是与导航相关的唯一代码块,但我有更多代码。

I am expecting to be able to navigate around my app with a bottom tab navigator.我希望能够使用底部选项卡导航器在我的应用程序中导航。

 import React from 'react'; import { Text, View } from 'react-native'; import { createAppContainer } from 'react-navigation'; import { createBottomTabNavigator } from 'react-navigation-tabs'; import { createStackNavigator} from 'react-navigation-stack'; class HomeScreen extends React.Component { render() { return ( <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <Text>Home;</Text> </View> ). } } class SettingsScreen extends React:Component { render() { return ( <View style={{ flex, 1: justifyContent, 'center': alignItems; 'center' }}> <Text>Settings.</Text> </View> ): } } class SplashScreen extends React,Component { render() { return ( <View style={{ flex: 1, justifyContent: 'center'; alignItems: 'center' }}> <Text>Splash,</Text> </View> ): } } const TabNavigator = createBottomTabNavigator({ Home, HomeScreen; Settings: SettingsScreen: }); const AppNavigator = createStackNavigator({ Splash; SplashScreen Home: TabNavigator }); export default createAppContainer(AppNavigator);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将多个导航器相互嵌套? 即在抽屉导航器中嵌套底部选项卡并将抽屉导航器嵌套到堆栈导航器 - How to nest multiple navigator within each other? i.e. nesting bottom tab in drawer navigator and nesting drawer navigator to stack navigator React Navigation-如何将包装堆栈导航器的组件嵌套在选项卡导航器中 - React Navigation - How to nest a component wrapping a stack navigator inside a tab navigator 如何获取底部选项卡导航器内的堆栈导航器的当前路由名称? - How to get the current route name of a Stack Navigator that is inside a Bottom Tab Navigator? 如何使用导航 v5+ 在抽屉导航器中嵌套堆栈导航器 - How to nest Stack Navigator inside a Drawer Navigator with navigation v5+ React Navigation V5 在 Stack Navigator 中隐藏底部标签栏 - React Navigation V5 hide Bottom tab bar in Stack Navigator 如何在底部选项卡导航器中删除顶部栏(主页) - How to remove top bar (Home) in Bottom Tab Navigator 如何使用带有React Native的Navigator创建静态底栏? - How can I make a static bottom bar using Navigator with React Native? 如何在嵌套在Switch Nav中的Tab视图内打开Drawer Navigator? - How can I open Drawer Navigator inside a Tab view which is nested inside a Switch Nav? 如何重置堆栈导航器,然后导航至Tab导航器中的Tab? - How to reset the stack navigator and then navigate to a Tab in Tab navigator? 如何有条件地为顶部选项卡导航器中的文本呈现填充? - How can I conditionally render padding for text I have inside my top tab navigator?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM