2

I am creating a mobile app using React Native, and I have ended up using react-navigation v6 for creating a drawer navigator in the Dashboard of my app. The Dashboard is only displayed when the user is logged, while the Login screen is shown when the user is not logged.

I want to add a drawer on the Dashboard, and to open it using a button on the top bar of the Dashboard. I have a DashboardScreens component that was only rendering the Dashboard component like this: return <Dashboard />;. What I did for creating the drawer was to import createDrawerNavigator from '@react-navigation/drawer' and NavigationContainer from '@react-navigation/native'. Now, the returned JSX from DashboardScreens looks like this:

         <NavigationContainer>
            <MenuNav.Navigator
                initialRouteName="Dashboard"
            >
                <MenuNav.Screen name="Dashboard" component={Dashboard} />
            </MenuNav.Navigator>
        </NavigationContainer>

The creation of the navigator was done above the definition of the DashboardScreens, through this line: const MenuNav = createDrawerNavigator();

However, all I get now is a blank screen.

enter image description here

gusti
  • 393
  • 4
  • 21

0 Answers0