-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Current behavior
On android, pressing on a drawer item does not navigate to the corresponding screen unless pressed very close to the drawer item text. A video showing this behaviour is included.
Code to reproduce:
import './gesture-handler';
import React from 'react';
import {
Text,
View,
} from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createDrawerNavigator } from '@react-navigation/drawer';
function App(): React.JSX.Element {
const Drawer = createDrawerNavigator();
const HomeScreen = () => {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Home Screen</Text>
</View>
);
}
const ProfileScreen = () => {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Profile Screen</Text>
</View>
);
}
return (
<NavigationContainer>
<Drawer.Navigator>
<Drawer.Screen name="Home" component={HomeScreen} />
<Drawer.Screen name="Profile" component={ProfileScreen} />
</Drawer.Navigator>
</NavigationContainer>
);
}
export default App;
https://www.youtube.com/shorts/1KKELfcDdJE
Expected behavior
Pressing anywhere across the full width of the drawer item should navigate to the corresponding screen.
Reproduction
https://github.com/nigelrudolf/drawer-bug
Platform
- Android
- iOS
- Web
- Windows
- MacOS
Packages
- @react-navigation/bottom-tabs
- @react-navigation/drawer
- @react-navigation/material-top-tabs
- @react-navigation/stack
- @react-navigation/native-stack
- react-native-drawer-layout
- react-native-tab-view
Environment
"dependencies": {
"@react-navigation/drawer": "^7.0.19",
"@react-navigation/native": "^7.0.13",
"react": "18.3.1",
"react-native": "0.76.3",
"react-native-gesture-handler": "^2.21.2",
"react-native-reanimated": "^3.16.3",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^4.3.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.3",
"@react-native/eslint-config": "0.76.3",
"@react-native/metro-config": "0.76.3",
"@react-native/typescript-config": "0.76.3",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}