Drawer Navigator does not open - React Native Navigation

Asked

Viewed 546 times

-1

I’m doing a project in React Native using the React Navigation 3.x and trying to use the Drawer Navigator, I’ve used it on React Navigation 2.7 and it worked perfectly, only now for some reason it does not open, I try to pull it on the screen and it does not open, I put in the method componentDidMount of the screen that the Drawer Navigator is the function this.props.navigation.openDrawer() and now when the screen is loaded Drawer appears only that I also can not close it, but if I click on one of the options of Drawer it selects and closes, it is as if the functions of opening and closing the Drawer sliding the finger on the screen were disabled, someone knows why this?

Code:

const Drawer = createDrawerNavigator({
  Horarios: {
    name: 'Horarios',
    screen: HorariosQueryComponent
  }

}, { drawerWidth: 250 });

export default createAppContainer(Drawer);

2 answers

0


-2

I have just had the same error in React-navigation v4 and by, in error it says that both v3 and v4 should work with createAppContainer, so I am providing my code for you to analyze

import React from 'react';
import { createAppContainer } from 'react-navigation';
import { createDrawerNavigator } from 'react-navigation-drawer';
import {} from 'react-native-screens';
import ParImpar from './pages/ParImpar';
import Export_Import from './pages/Componente';
import MegaCena, {Invert} from './pages/ExpImp';


export default createAppContainer(
    createDrawerNavigator({
        MegaCena:{
            screen: () => <MegaCena numbers={3} />,
            NavigatorOptions: {title: "Mega cena"}
        },
        Invert:{
            screen: () => <Invert sentece="Native" />
        },
        Export_Import:{
            screen: () => <Export_Import texto="MAJ" />
        },
        ParImpar:{
            screen: () => <ParImpar number = {3}/>,
            NavigatorOptions: {title: "Par ou Impar"} 
        }
    }, { drawerWidth: 300 })
)

Browser other questions tagged

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