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

Global modal is misaligned when using Drawer Layout #12301

Open
3 of 13 tasks
Tencryn opened this issue Nov 26, 2024 · 3 comments
Open
3 of 13 tasks

Global modal is misaligned when using Drawer Layout #12301

Tencryn opened this issue Nov 26, 2024 · 3 comments

Comments

@Tencryn
Copy link

Tencryn commented Nov 26, 2024

Current behavior

Prior to updating RN and RN Navigation, I was able to have a global modal using a context without any issue with how it displayed. Since the update, the modal displays at the top left. I cannot clarify what version I was on prior to updating, but I do know I was on RN 0.74 at the time that it was functioning correctly.

I can confirm that a modal that's local will display correctly, and I can confirm that it is caused by having the Drawer component. I cannot test on iOS, but the repro shows no issues with iOS so the issue might be isolated to Android.

This is how the modal appears, note the white rectangle at the top left:
Image

Expected behavior

I expect to see the modal positioned in the middle, exactly the way the local modal is displaying.

It should look like this:
Image

Reproduction

https://snack.expo.dev/Hcyvr2Ei__HI1bM6uUEBw

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

  • I've removed the packages that I don't use
package version
@react-navigation/native 7.0.6
@react-navigation/native-stack 7.1.7
react-native-drawer-layout 4.0.2
react-native-screens 4.3.0
react-native-safe-area-context 4.14.0
react-native-gesture-handler 2.21.2
react-native-reanimated 3.16.2
react-native 7.0.6
node 21.1.0
npm or yarn npm
@satya164
Copy link
Member

Is this an issue with Drawer or Reanimated? Can you reproduce this without Drawer, but using Reanimated in the app?

@Tencryn
Copy link
Author

Tencryn commented Nov 26, 2024

Is this an issue with Drawer or Reanimated? Can you reproduce this without Drawer, but using Reanimated in the app?

I'm unsure specifically, I was able to reproduce the drawer and thus the issue with using Reanimated but I'm unsure if it's Reanimated directly or just the styling of the drawer. Remove the drawer itself, and the problem goes away.
https://snack.expo.dev/06-mUVsUCmpSOsOMudTRT

I was able to get the global modal to work by wrapping it in it's own View, with no styling attached, but this wasn't necessarily previously. It's a hilariously simple fix, but I'm under the assumption that it wasn't intended to break in the first place.

@codeAbinash
Copy link

Wrapping the Modal with a View works. I wasted 4 hours to fix this. Thanks for sharing your solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants