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
fix: [Drawer] fix iOS wrong detected frame dimensions #11632
base: main
Are you sure you want to change the base?
Conversation
Hey @onmotion! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines. |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11632 +/- ##
=======================================
Coverage 75.69% 75.69%
=======================================
Files 202 202
Lines 5850 5850
Branches 2301 2301
=======================================
Hits 4428 4428
Misses 1371 1371
Partials 51 51
☔ View full report in Codecov by Sentry. |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Thank you for the PR!
I believe that this should be fixed in the safe-area-context library.
@satya164 had issues with useWindowDimensions returning the wrong value on Samsung phones so I don't think that's the solution.
Also changes the behaviour, e.g. it'll give screen dimensions instead of the dimensions of the frame where the navigation tree is.
for sure, this should be fixed in in the safe-area-context library, but this issue exist for years and still there. And I didn't found the case when the Drawer could be behind the frame but not the actual screen. |
I'm experiencing this same issue and manually patching the drawer with this change fixed it. Thanks @onmotion! |
encountered the same issue, thank you @onmotion! would be great to have this merged |
I am encountering the same issue and this fix is perfect for my work, thank you @onmotion It does look like this may be taken care of in this PR for safe area context |
Motivation
It seems that under certain scenarios on iOS, the useSafeAreaFrame hook is returning incorrect dimensions. The issue may lie in the native implementation of methods responsible for layout (
layoutSubviews
,layoutIfNeeded
, etc). However, we only require theheight
andwidth
of the main window, as the Drawer is hidden behind the root View and we do not need the x and y coordinates of the top frame as SafeAreaRect
provides.Test plan
Open Drawer
Open iOS Modal
dimensions values are correct and event is broadcasting properly
Rotate screen landscape
Rotate screen portrait
dimensions values broken and are no longer broadcast
Close modal
The change must pass lint, typescript and tests.
Simulator.Screen.Recording.-.iPhone.15.-.2023-10-08.at.09.17.57.mp4
Untitled.mov
RN info
Navigator snippet to reproduce