made it so there is no hamburger menu instead the user swips to open the drawer, issue for those android devices with no soft/hard buttons, gesture controls take over and utilise the android back feature rather than the app's swipe to open drawer, however works fine on other devices that use soft coded / hard buttons.

This commit is contained in:
bobbert committed 2025-12-07 20:47:28 +00:00
1 parent 09f92febf9
commit 30474c19bb
1 file changed
+12 -4
+12 -4
View File
@@ -9,6 +9,7 @@ import UserViewScreen from "./src/components/screens/UserViewScreen";
import UserAddScreen from "./src/components/screens/UserAddScreen"; import UserAddScreen from "./src/components/screens/UserAddScreen";
import UserListScreen from "./src/components/screens/UserListScreen"; import UserListScreen from "./src/components/screens/UserListScreen";
import {createDrawerNavigator} from '@react-navigation/drawer'; import {createDrawerNavigator} from '@react-navigation/drawer';
import {StyleSheet} from "react-native";
const Drawer = createDrawerNavigator(); const Drawer = createDrawerNavigator();
const Stack = createNativeStackNavigator(); const Stack = createNativeStackNavigator();
@@ -17,12 +18,14 @@ const ModuleStack = () => (
<Stack.Navigator <Stack.Navigator
initialRouteName='ModuleListScreen' initialRouteName='ModuleListScreen'
screenOptions={{ screenOptions={{
headerShown: false // Hide stack headers headerStyle: {backgroundColor: "black"},
headerTintColor: "white"
}} }}
> >
<Stack.Screen <Stack.Screen
name="ModuleListScreen" name="ModuleListScreen"
component={ModuleListScreen} component={ModuleListScreen}
options={{headerShown: true}}
/> />
<Stack.Screen <Stack.Screen
name="ModuleAddScreen" name="ModuleAddScreen"
@@ -42,12 +45,16 @@ const ModuleStack = () => (
const UserStack = () => ( const UserStack = () => (
<Stack.Navigator <Stack.Navigator
screenOptions={{ screenOptions={{
headerShown: false // Hide stack headers headerStyle: {backgroundColor: "black"},
headerTintColor: "white",
swipeEdgeWidth: 100,
drawerType: 'slide',
}} }}
> >
<Stack.Screen <Stack.Screen
name="UserListScreen" name="UserListScreen"
component={UserListScreen} component={UserListScreen}
options={{headerShown: true}}
/> />
<Stack.Screen <Stack.Screen
name="UserAddScreen" name="UserAddScreen"
@@ -69,8 +76,9 @@ export const App = () => {
<NavigationContainer> <NavigationContainer>
<Drawer.Navigator <Drawer.Navigator
screenOptions={{ screenOptions={{
headerStyle: {backgroundColor: "black"}, headerBackgroundColor: "black",
headerTintColor: "white" headerShown: false,
swipeEnabled: true
}} }}
> >
<Drawer.Screen <Drawer.Screen