From 00a942c905e4c08e115b30e5c3188fd5e3b5e9f1 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 30b50691b9651a..33076a0729629b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java @@ -705,6 +705,7 @@ private void checkForDeviceOrientationChanges() { return; } mDeviceRotation = rotation; + DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext()); emitOrientationChanged(rotation); }