software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
5.85k stars 954 forks source link

DrawerLayout broken on RN 0.70 #2208

Open lightrow opened 1 year ago

lightrow commented 1 year ago

Description

Updated RN from 0.68 to 0.70 - DrawerLayout reappears right after closing and stays on the screen until you try to pull it out again

Steps to reproduce

  1. Open DrawerLayout
  2. Close DrawerLayout
  3. Drawer pops back after closing and doesn't go away

Snack or a link to a repository

--

Gesture Handler version

2.6.0

React Native version

0.70.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 1 year ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] commented 1 year ago

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or a link to a repository section.

renchap commented 1 year ago

I can confirm this on my app, it happens with both iOS and Android after upgrading from RN 0.69.4 to RN 0.70.0

siderakis commented 1 year ago

https://github.com/software-mansion/react-native-gesture-handler/blob/main/example/src/new_api/betterHorizontalDrawer/BetterHorizonatalDrawer.tsx is working for RN 70 although the touch interaction is slightly different (at-least for draw type "front"). The border edge jumps to where the finger is which can be quite abrupt when it in the middle of the draw.

renchap commented 1 year ago

As mentioned in https://github.com/facebook/react-native/issues/34665, using <DrawerLayout useNativeAnimations={false} /> fixes the issue.

This is a workaround until the real Animated bug is fixed, I tested it both on Android and iOS.

j-piasecki commented 1 year ago

Fixed in https://github.com/facebook/react-native/pull/34927.

atheck commented 1 year ago

I still have that issue with react-native 0.70.4 and react-native-gesture-handler 2.8.0 using the old architecture.

Setting useNativeAnimations to false fixes the issue, but the animations are stuttering. Am I missing something?

Nova41 commented 1 year ago

Still getting the bug in 0.70.4.

Ahsan-J commented 1 year ago

Using RN 0.70.6. I am still getting the issue. Any workaround to solve it?

I don't want to set useNativeAnimations to false.

mikehardy commented 1 year ago

Desire aside, the only workaround appears to be as described: disable native animations Alternatively, the fix commit link shows it is on the react-native 0.71 stable branch, which is on rc3 at the moment), so if you desire native animations strongly enough, update to react-native 0.71.0-rc.3 to get the solution, or wait until 0.71.0 is released as stable then upgrade

kelset commented 1 year ago

@mikehardy that commit has been cherry picked in 0.70.3: https://github.com/facebook/react-native/releases/tag/v0.70.3

mikehardy commented 1 year ago

Oh! That changes things if I misread that, sorry everyone. So this should be fixed but is not? 🤔

kelset commented 1 year ago

it should, yeah

j-piasecki commented 1 year ago

It seems like the problem still persists when the animation gets interrupted by another one. I've added a comment with an explanation and repro in the issue in the React Native repo.

hotaryuzaki commented 1 year ago

I can confirm this issue still exists in react-native-gesture-handler 2.8.0 if i open the drawer and quickly close it, the drawer view will reappear. and then I cannot close it again. it looks like that open animation process still running and change the state. useNativeAnimations set to false solve the issue.

so the problem is from RN core?

j-piasecki commented 1 year ago

@hotaryuzaki Yes, the problem is from RN core, but AFAIK the 0.71 doesn't have that issue so upgrading may solve the problem.

Nvm, it seems like it doesn't help.

segicm commented 1 year ago

Any updates on this? The problem persists for the past 6 months...

lightrow commented 1 year ago

we are still using this https://github.com/software-mansion/react-native-gesture-handler/blob/main/example/src/new_api/betterHorizontalDrawer/BetterHorizonatalDrawer.tsx with some tweaks to make drawerType={'slide'} work at cost of others that we don't need

just be aware that it causes a crash on hot-reload on iOS due to new Gesture API https://github.com/software-mansion/react-native-reanimated/issues/3884

Adr1anPopescu commented 1 year ago

Any update here?

dinhthi147 commented 9 months ago

Any updates on this? I still have to disable useNativeAnimations

traxx10 commented 8 months ago

Same issue here as well

linxianxi commented 7 months ago

same

shubhamguptadream11 commented 6 months ago

Same issue here as well in RN 0.72.4withreact-native-gesture-handler": "2.7.1. By disabling native animations it worked but I don't want to do that.

linxianxi commented 6 months ago

try https://reactnavigation.org/docs/drawer-layout/ I used this now, it works fine.