Open agusvazquez opened 2 weeks ago
Hello React Native team. I found a bug that useWindowDimensions hook returns old values after rotating the phone when it is locked.
const { height, width } = useWindowDimensions();
Tested on iOS.
0.74.2
Runtime - iOS
npx react-native info
System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Pro Memory: 1.27 GB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 22.3.0 path: /opt/homebrew/bin/node Yarn: version: 4.2.2 path: /opt/homebrew/bin/yarn npm: version: 10.8.1 path: /opt/homebrew/bin/npm Watchman: version: 2024.06.10.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.5 - iOS 17.5 - macOS 14.5 - tvOS 17.5 - visionOS 1.2 - watchOS 10.5 Android SDK: Not Found IDEs: Android Studio: 2024.1 AI-241.15989.150.2411.11948838 Xcode: version: 15.4/15F31d path: /usr/bin/xcodebuild Languages: Java: version: 17.0.10 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: Not Found react-native: installed: 0.74.2 wanted: "*" react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: Not found newArchEnabled: Not found iOS: hermesEnabled: true newArchEnabled: false
Start in portrait mode: LOG {"height": 812, "width": 375} Rotated to landscape: LOG {"height": 375, "width": 812} Rotated to portrait LOG {"height": 812, "width": 375} Rotated to landscape LOG {"height": 375, "width": 812} Locked screen Rotated to portrait Unlocked screen
https://github.com/agusvazquez/react-native-bug
No response
Potentially a duplicate of one of those: https://github.com/facebook/react-native/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+useWindowDimensions
Description
Hello React Native team. I found a bug that useWindowDimensions hook returns old values after rotating the phone when it is locked.
Steps to reproduce
const { height, width } = useWindowDimensions();
Tested on iOS.
React Native Version
0.74.2
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/agusvazquez/react-native-bug
Screenshots and Videos
No response