I want to have an App with BottomTabNavigation. Also I want to have a DrawerNavigation to be available from all Tabs.
My AppNavigator.js
contains the following. I only can "access" the TabNavigator. Drawer is not accessible.
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer, StackActions, StackNavigator } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createDrawerNavigator } from '@react-navigation/drawer';
const Tabs = createBottomTabNavigator();
const TabsScreen = () => (
<Tabs.Navigator>
<Tabs.Screen name="Page1" component={Page1} />
<Tabs.Screen name="Page2" component={Page2} />
<Tabs.Screen name="Page3" component={Page3} />
<Tabs.Screen name="Page4" component={Page4} />
</Tabs.Navigator>
)
const Drawer = createDrawerNavigator();
const DrawerScreen = () => (
<Drawer.Navigator>
<Drawer.Screen name="Drawer-Item1" component={Drawer-Item1} />
<Drawer.Screen name="Drawer-Item2" component={Drawer-Item2} />
</Drawer.Navigator>
)
const Stack = createStackNavigator();
export default () => (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Tabs" component={TabsScreen} />
<Stack.Screen name="Drawer" component={DrawerScreen} />
</Stack.Navigator>
</NavigationContainer>
)
If I put the DrawerScreen into the first element of TabsScreen, the DrawerNavigation only is accessible at the first Tab, but not at all other tabs. Vice Versa the same. If I put the TabsScreen into the first element of the DrawerScreen, the tabs are only accessible at the first element of the DrawerScreen.
How can I achieve to access the Drawer at all Tabs? I want to have the Tabs as my main navigation, but because there are more Menu options, I want the user to have access to the drawer from all views. Every Tab has its own screen, with own features. When I open the Drawer and access one Drawer entry, it opens another screen, wehre also is the "Main" Tab Navigation.
Any ideas? :-)