How to disable React Navigation Drawer on specific routes

0

Hello, I'm creating an application that should not display Drawer on specific routes like login, registry, etc. Currently my file looks 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 the drawer to only appear in LanScreen . How do I configure the Navigator so that it does not appear on certain screens?

  

In the above file I am using the react-navigation-fluid-transitions library but it is an extension of react-navigation so the question fits into the 2 libraries.

    
asked by anonymous 11.10.2018 / 17:28

1 answer

1

You can create two stacks, one for screens that will not 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,
});
    
12.10.2018 / 18:42