[英]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.