root-two / react-native-drawer

React Native Drawer
MIT License
2.54k stars 392 forks source link

Best way to show drawer on all screens #387

Open mitesh-db opened 4 years ago

mitesh-db commented 4 years ago

Hello, thank you for the awesome library.

I have no issue but I want to know that is there any great way to show same drawer on all screens?

For now, I'm using one drawer component for all screens.

hanaechahid commented 3 years ago

Hi @mitjnextt, I have the same issue, did you find a way to have an option to open an close the same drawer on many screens?

RayyanNafees commented 3 years ago

According to me, the best way is to wrap the screen navigation component inside the drawer like so

const drawerRef= React.createRef()

<Drawer 
    ref={drawerRef}
    {...drawerProps} />

   <NavigationContainer>
        <Stack.Screen name="Home" component={Home} />
        ...
   </NavigationContainer>
</Drawer>