Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with permissions dialog and position #386

Closed
ahce opened this issue Dec 15, 2018 · 19 comments · Fixed by #2005
Closed

Bug with permissions dialog and position #386

ahce opened this issue Dec 15, 2018 · 19 comments · Fixed by #2005
Assignees
Labels

Comments

@ahce
Copy link

ahce commented Dec 15, 2018

Description

  • Position bug: The drawer is behind the button:
    image
  • Position fix: Set zIndex
    image
  • Permission dialog bug: The drawer in close mode is visible behind the dialog, this occur in special situations
    • Form 1:
      • First: press next up to value 2
      • Second: focus the textinput and open keyboard
      • Third: press next again
    • Form 2:
      • First: press next or back button repeatedly

Steps
image

Result
image

Note

This bugs don't occur with react-native-drawer-layout-polyfill.
In the demo, comment and uncomment the imports for switch the drawers.
image

Environment

  • react: 16.6.3
  • react-native: 0.57.8
  • react-native-gesture-handler: 1.0.12
  • phone: Nokia 5 Android 8.1

Demo

RNGH-DrawerLayout-Bug

@osdnk
Copy link
Contributor

osdnk commented Dec 18, 2018

@brentvatne

@brentvatne
Copy link
Contributor

brentvatne commented Dec 18, 2018

thanks for putting effort into this issue! unfortunately I'm still having a hard time understanding because it feels like there are two issues together here.

  1. Button appears above drawer. The Button component in react-native uses elevation which has the same effect as zIndex. We could perhaps set some elevation on the drawer on Android, or a zIndex. Does this make sense to you?
  2. "The drawer is visible behind the dialog, this occur in special situations" - it's unclear to me why this isn't desirable. If you open a permissions dialog and the drawer is open, why would you hide the drawer?

@ahce
Copy link
Author

ahce commented Dec 18, 2018

@brentvatne Thanks for your reply.

  1. Yes, the problem is the elevation, where zIndex is the fix.

  2. Special situations are those reported in the steps of Form 1 and 2 where the drawer is closed.

Please test my repo RNGH-DrawerLayout-Bug

@ahce
Copy link
Author

ahce commented Dec 24, 2018

@brentvatne the bug when drawer is closed and is visible behind the alert, don't occur with useNativeAnimations set in false.
It is possible to set useNativeAnimations to false by default?

@brentvatne
Copy link
Contributor

cc @kmagiera ^

@osdnk
Copy link
Contributor

osdnk commented Dec 26, 2018

@ahce, I don't want to change useNativeAnimations to false. It's not a point of this library. Will try to figure it out

@ahce
Copy link
Author

ahce commented Feb 18, 2019

@brentvatne @osdnk I found an easier way to reproduce the bug. Check my repo RNGH-DrawerLayout-Bug (dependencies updated to the latest).
I also found a possible solution, they are changes in 3 lines (11, 73, 529), please check this.

@sign2k
Copy link

sign2k commented Mar 12, 2019

I am experiencing the same problem (using react-native-navigation 3.3.2 + react-native-gesture-handler 1.1.0). My app navigates to a new screen and checks some Android permissions after mounting the screen component.

PermissionsAndroid.requestMultiple([
                "android.permission.ACCESS_FINE_LOCATION",
                "android.permission.ACCESS_COARSE_LOCATION",
                "android.permission.BLUETOOTH",
                "android.permission.BLUETOOTH_ADMIN"])

The drawer appears behind the android action dialog although it should not be visible at all.
useNativeAnimations: false solves the problem but of course is not the best solution.

@ahce
Copy link
Author

ahce commented Mar 13, 2019

@sign2k Can you test this DrawerLayout?

@sign2k
Copy link

sign2k commented Mar 14, 2019

@sign2k Can you test this DrawerLayout?

Tested it - seems not to help in my case. I replaced the offical "DrawerLayout.js" with your file.

@ahce
Copy link
Author

ahce commented Mar 16, 2019

@sign2k
The problem occurs when there is a render after the dialog is opened.
In my repo, DrawerLayout as PureComponent avoids rendering when the keyboard is hidden, after trying to share the text, but it is not enough for all cases.

@m3dwards
Copy link

m3dwards commented Apr 3, 2019

I've also got an app that requests permissions after navigating to a screen and it opens the drawer while the permission dialog is up.

@alburdette619
Copy link

I'm having this issue too. Should the missing info label be taken off? It seems like @ahce has verified it and the cause pretty well.

@nash2196
Copy link

nash2196 commented Sep 8, 2019

What is the fix for this? This is still an issue.

@KAngel7
Copy link

KAngel7 commented Sep 10, 2019

I faced the same issue "the drawer appears behind the android action dialog" with "react-native-gesture-handler": "^1.2.0" and "react-navigation": "3.2.0" but some devices works and some are not. Not sure where it come from, please help

@cayodonatti
Copy link

Same problem here as of rn 0.61, rngh 1.4.1

@pravin-maan
Copy link

thanks
useNativeAnimations:false,
it's working

@CoolCola
Copy link

useNativeAnimations:false works, not the best, other solutions?

@jakub-gonet jakub-gonet added Platform: Android This issue is specific to Android Bug Area: Drawer labels Sep 2, 2020
@jakub-gonet jakub-gonet changed the title [DrawerLayout] Bug with permissions dialog and position Bug with permissions dialog and position Sep 2, 2020
@fleidloff
Copy link

same here, any ideas? useNativeAnimation:false is not an option for us

j-piasecki added a commit that referenced this issue Apr 27, 2022
Fixes #386.

`AnimatedInterpolation` was causing problems on Android when the activity was paused for some reason (like permission or share dialog). For some reason it was changing its value on pause, opening the drawer, and again on resume closing the drawer. This PR changes `DrawerLayout` so that it uses constant value instead of interpolation when the drawer is idle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet