react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

DrawerLayout broken on RN 0.70

Open lightrow opened this issue 3 years ago • 24 comments

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

lightrow avatar Sep 07 '22 17:09 lightrow

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] avatar Sep 07 '22 17:09 github-actions[bot]

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.

github-actions[bot] avatar Sep 07 '22 17:09 github-actions[bot]

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

renchap avatar Sep 07 '22 20:09 renchap

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.

siderakis avatar Sep 12 '22 03:09 siderakis

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.

renchap avatar Sep 16 '22 19:09 renchap

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

j-piasecki avatar Oct 11 '22 12:10 j-piasecki

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?

atheck avatar Oct 26 '22 08:10 atheck

Still getting the bug in 0.70.4.

Nova41 avatar Nov 11 '22 06:11 Nova41

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.

Ahsan-J avatar Dec 06 '22 05:12 Ahsan-J

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

mikehardy avatar Dec 06 '22 14:12 mikehardy

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

kelset avatar Dec 06 '22 17:12 kelset

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

mikehardy avatar Dec 06 '22 17:12 mikehardy

it should, yeah

kelset avatar Dec 06 '22 17:12 kelset

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.

j-piasecki avatar Dec 07 '22 10:12 j-piasecki

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?

hotaryuzaki avatar Jan 13 '23 04:01 hotaryuzaki

@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.

j-piasecki avatar Jan 13 '23 08:01 j-piasecki

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

segicm avatar Mar 06 '23 09:03 segicm

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

lightrow avatar Mar 07 '23 18:03 lightrow

Any update here?

Adr1anPopescu avatar May 10 '23 13:05 Adr1anPopescu

Any updates on this? I still have to disable useNativeAnimations

dinhthi147 avatar Aug 10 '23 12:08 dinhthi147

Same issue here as well

traxx10 avatar Sep 12 '23 13:09 traxx10

same

linxianxi avatar Oct 13 '23 07:10 linxianxi

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

shubhamguptadream11 avatar Oct 18 '23 13:10 shubhamguptadream11

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

linxianxi avatar Oct 18 '23 14:10 linxianxi