Skip to content

Commit 9f0a521

Browse files
authored
ReanimatedDrawerLayout: fix buttons not receiving onPress (#3832)
## Description When using ReanimatedDrawerLayout, none of the react-native-gesture-handler buttons respond to taps because of the `overlayDismissGesture`. The gesture is activated even when the Drawer is closed. By passing in `drawerOpened`, a state variable already enabled into `overlayDismissGesture` the problem is fixed and the drawer continues working as-is. ## Test plan In my own app, I added `drawerOpened` into `overlayDismissGesture` and was able to successfully fix the problem.
1 parent 3f13c2a commit 9f0a521

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/react-native-gesture-handler/src/components/ReanimatedDrawerLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ const DrawerLayout = forwardRef<DrawerLayoutMethods, DrawerLayoutProps>(
500500
const overlayDismissGesture = useMemo(
501501
() =>
502502
Gesture.Tap()
503+
.enabled(drawerOpened)
503504
.maxDistance(25)
504505
.onEnd(() => {
505506
if (
@@ -509,7 +510,7 @@ const DrawerLayout = forwardRef<DrawerLayoutMethods, DrawerLayoutProps>(
509510
closeDrawer();
510511
}
511512
}),
512-
[closeDrawer, isDrawerOpen, drawerLockMode]
513+
[closeDrawer, isDrawerOpen, drawerLockMode, drawerOpened]
513514
);
514515

515516
const overlayAnimatedStyle = useAnimatedStyle(() => ({

0 commit comments

Comments
 (0)