-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Dimensions.get('screen') is returning reversed values for height and width #29105
Description
Description
When I am using Dimensions.get('screen').width and Dimensions.get('screen').height, I am getting the values as reversed sometimes (i.e width is coming as height and height as width).
This is occurring randomly when the application is launched.
The application is supported only in landscape mode.
React Native version:
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 22.54 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.16.1 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6241897
Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Use Dimensions.get('screen').width and Dimensions.get('screen').height, its populating reversed values. This is happening randomly sometimes.
Expected Results
The width and height should be populated correctly
Snack, code example, screenshot, or link to a repository:
The expected result is the below screen.

But since the width and height are reversed, we are getting the screen as below.
