How to disable React Navigation Drawer on specific routes

Asked

Viewed 462 times

0

Hello, I’m creating an application that should not display Drawer on specific routes like login, registration, etc. Currently my file is like this:

import React from 'react'
import { FluidNavigator } from 'react-navigation-fluid-transitions'

import SplashScreen from '../../screens/SplashScreen'
import LoginScreen from '../../screens/LoginScreen'
import RegisterScreen from '../../screens/RegisterScreen'
import LanScreen from '../../screens/LanScreen'

export default Navigator = FluidNavigator({
  SplashScreen: { screen: SplashScreen },
  LoginScreen: { screen: LoginScreen, },
  RegisterScreen: { screen: RegisterScreen },
  LanScreen: { screen: LanScreen }
});

I need Drawer to just show up at LanScreen. How do I set up Navigator so it doesn’t appear on certain screens?

In the file above I’m using the library react-navigation-fluid-transitions but she’s an extension of react-navigation so the question fits for the 2 libraries.

1 answer

1


You can create two Stacks, one for screens that won’t have Drawer and one with Fluidnavigator:

import React from 'react'
import { FluidNavigator } from 'react-navigation-fluid-transitions'
import { createStackNavigator } from 'react-navigation';

import SplashScreen from '../../screens/SplashScreen'
import LoginScreen from '../../screens/LoginScreen'
import RegisterScreen from '../../screens/RegisterScreen'
import LanScreen from '../../screens/LanScreen'

const DrawerNavigator = FluidNavigator({
  LanScreen: { screen: LanScreen }
});

export defaut createStackNavigator({
  SplashScreen,
  LoginScreen,
  RegisterScreen,
  DrawerNavigator,
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.