TabsNavigator inside StackNavigator

前端 未结 1 1242
时光取名叫无心
时光取名叫无心 2021-02-08 11:45

I\'m using React-Navigation and I have a StackNavigator, this is the app.js with the Stack + Tabs Navigator:

import React from \'react\';
import { AppRegistry }          


        
1条回答
  •  庸人自扰
    2021-02-08 12:10

    You can use TabNavigator as screen for StackNavigator in order to nest.

    const Stylelist = StackNavigator({
      Login: {
        screen: LoginScreen,
        navigationOptions: ({ navigation }) => ({
          header: null,
        }),
      },
      Register: {
        screen: RegisterScreen,
        navigationOptions: ({ navigation }) => ({
          header: null,
        }),
      },
      Home: {
        screen: TabNavigator({
          Home: {
            screen: HomeScreen,
            navigationOptions: ({ navigation }) => ({
              title: 'Home',
            }),
          },
          Friends: {
            screen: FriendsScreen,
            navigationOptions: ({ navigation }) => ({
              title: 'My Friends',
            }),
          },
        }),
        navigationOptions: ({ navigation }) => ({
          title: 'Home',
        }),
      },
    });
    
    export default Stylelist;
    

    0 讨论(0)
提交回复
热议问题