From 9c132c412494bf62dde54accbf0c684d5144f1fd Mon Sep 17 00:00:00 2001 From: ajpaulingalls Date: Wed, 11 Nov 2020 11:00:07 -0800 Subject: [PATCH] Update the cached dimensions when orientation changes (#30324) Summary: Currently the dimensions are created once, and then cached. This change will reload the dimensions when the device orientation changes to insure that dimension update events follow orientation changed events. this should help address the following issues, that I know of: https://github.com/facebook/react-native/issues/29105 https://github.com/facebook/react-native/issues/29451 https://github.com/facebook/react-native/issues/29323 ## Changelog [Android] [Fixed] - Dimension update events are now properly sent following orientation change Pull Request resolved: https://github.com/facebook/react-native/pull/30324 Test Plan: Open up RNTester app. Select the Dimensions API list item. Rotate the device and verify that the dimensions are correct based on orientation. Reviewed By: fkgozali Differential Revision: D24874733 Pulled By: ejanzer fbshipit-source-id: 867681ecb009d368a2ae7b67d94d6355e67dea7b --- ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java index 9098fa1a2fc4db..a205467c094287 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java @@ -756,6 +756,7 @@ private void checkForDeviceOrientationChanges() { return; } mDeviceRotation = rotation; + DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext()); emitOrientationChanged(rotation); }