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

Dimensions not updating on iPad due to screen rotation. #7340

Closed
ghuh opened this issue May 3, 2016 · 12 comments
Closed

Dimensions not updating on iPad due to screen rotation. #7340

ghuh opened this issue May 3, 2016 · 12 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ghuh
Copy link

ghuh commented May 3, 2016

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)

@simosalmi
Copy link

I'm having the same issue. Is anybody working on this? A solution would be much appreciated. Thanks

@ghuh
Copy link
Author

ghuh commented Aug 15, 2016

This is still broken as of RN v0.31.0

@mahlon-gumbs
Copy link

mahlon-gumbs commented Sep 25, 2016

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

@ghuh
Copy link
Author

ghuh commented Sep 29, 2016

I'm now running into the same issue on an Android 7.0 simulator with RN v0.33.0

@messense
Copy link

Just run into this issue with React Native 0.37.

@mrpp01
Copy link

mrpp01 commented Nov 21, 2016

I tried to reproduce this bug, but it seems to work fine for me.
RN version 0.37

@adrienbataille
Copy link

When I'm rotating the iPad, dimensions are not updated as you can on pictures:

capture d ecran 2016-12-08 a 14 03 59
capture d ecran 2016-12-08 a 14 04 07

If you want to test it: https://github.com/adrienbataille/test-react-native

Note: It works fine on iPhone

Additional Information

React Native version: 0.39.1
Platform: iOS
Operating System: MacOS - Sierra

@manicakes
Copy link

manicakes commented Dec 8, 2016

My PR here: #11350 fixes the bug.

@michaelcpuckett
Copy link

+1

facebook-github-bot pushed a commit that referenced this issue Dec 19, 2016
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
DanielMSchmidt pushed a commit to DanielMSchmidt/react-native that referenced this issue Jan 4, 2017
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
@sospedra
Copy link

still having the issue, the PR looks unmerged

@hramos
Copy link
Contributor

hramos commented Jul 20, 2017

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:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

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.

@hramos hramos closed this as completed Jul 20, 2017
@alainib
Copy link

alainib commented Feb 5, 2018

i test my react native app on a ipad air MD791NF/A.
with Dimensions.get("window") i get 480 x 320 instead of much bigger screen resolution. idem withDimensions.get("screen").
what i'm missing ?

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests