Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

react native - Remove tabnavigator from screen in createStackNavigator

I want to remove tabnavigator from screen2

const switchNavigator = createSwitchNavigator({
  registration: createStackNavigator({
    first: First,
    second: Second,
    third: Third,

  }),
  tabScreens: createBottomTabNavigator({
    Index: createStackNavigator({
      screen1: Screen1,
      screen2: Screen2,
    }),
  index2: Index2
  }),
});

I want to remove tabNavigator in screen2. How can i handle this ? it should be in createStackNavigator.

question from:https://stackoverflow.com/questions/65842777/remove-tabnavigator-from-screen-in-createstacknavigator

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here you can use the below code in Screen2 Component like:

import React from "react"
import { View, Text } from "react-native";

const Screen2 = props => {
    return (
        <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
            <Text>SCREEN 2</Text>
        </View>
    );
};

Screen2.navigationOptions = navData => {
    return {
         tabBarVisible: false,
    };
};

export default Screen2;

it will remove the bottom tab bar for the specific screen containing in createBottomTab Navigator


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...