-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Dimensions not updating on iPad due to screen rotation. #7340
Comments
I'm having the same issue. Is anybody working on this? A solution would be much appreciated. Thanks |
This is still broken as of RN v0.31.0 |
I've just run into this with RN v0.33.0 and RN v0.34.0 (tested on sim and physical device and the issue exists on both). |
I'm now running into the same issue on an Android 7.0 simulator with RN v0.33.0 |
Just run into this issue with React Native 0.37. |
I tried to reproduce this bug, but it seems to work fine for me. |
When I'm rotating the iPad, dimensions are not updated as you can on pictures: If you want to test it: https://github.com/adrienbataille/test-react-native Note: It works fine on iPhone Additional InformationReact Native version: 0.39.1 |
My PR here: #11350 fixes the bug. |
+1 |
Summary: On certain devices (in my case, any iPad Pro model), listening to `DeviceEventEmitter.didUpdateDimensions` would call back *before* the interface change takes places (i.e. calling `Dimensions.get()` in this callback would return wrong values). Turns out that we were listening for the wrong native event. Edit to add: now using `[RCTSharedApplication() statusBarOrientation]` to get the current orientation. Not yet sure why, but the `userInfo` provided by the notification was returning the wrong orientation *only* on the first time you rotate the device. This fixes the open issue: #7340 Closes #11350 Differential Revision: D4348186 Pulled By: javache fbshipit-source-id: cb2cfb9cccfc459ad4b46a5af2bec4c973132ae8
Summary: On certain devices (in my case, any iPad Pro model), listening to `DeviceEventEmitter.didUpdateDimensions` would call back *before* the interface change takes places (i.e. calling `Dimensions.get()` in this callback would return wrong values). Turns out that we were listening for the wrong native event. Edit to add: now using `[RCTSharedApplication() statusBarOrientation]` to get the current orientation. Not yet sure why, but the `userInfo` provided by the notification was returning the wrong orientation *only* on the first time you rotate the device. This fixes the open issue: facebook#7340 Closes facebook#11350 Differential Revision: D4348186 Pulled By: javache fbshipit-source-id: cb2cfb9cccfc459ad4b46a5af2bec4c973132ae8
still having the issue, the PR looks unmerged |
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
i test my react native app on a ipad air MD791NF/A. |
On an iPad (both physical and simulator), the Dimensions are not getting updated correctly after screen rotation. The same code works just fine on an iPhone.
What is really interesting is that it appears that the Dimensions are getting set on iPad, just one rotation behind. So, every time I call Dimensions as I rotate the device repeatedly between landscape and portrait, the width and height are always reversed of what they should be.
This was using RN v0.24.0-rc3. (i.e. after b653d43)
The text was updated successfully, but these errors were encountered: