Skip to content
Permalink
Browse files
Don't emit dimensions update event on initial load
Summary: On iOS we don't emit the didUpdateDimensions event in JS when the first React Native screen is rendered, so let's keep the behavior the same on Android.

Reviewed By: mdvacca

Differential Revision: D19506829

fbshipit-source-id: d0122d18be79177318c3f059ed396f990eeabcb7
  • Loading branch information
Emily Janzer authored and facebook-github-bot committed Jan 22, 2020
1 parent 86fd4b5 commit 383934a06e22e8e1a5ee50d121722240259f95d0
Showing 1 changed file with 3 additions and 1 deletion.
@@ -89,7 +89,9 @@ public void emitUpdateDimensionsEvent() {
// Don't emit an event to JS if the dimensions haven't changed
WritableNativeMap displayMetrics =
DisplayMetricsHolder.getDisplayMetricsNativeMap(mFontScale);
if (!displayMetrics.equals(mPreviousDisplayMetrics)) {
if (mPreviousDisplayMetrics == null) {
mPreviousDisplayMetrics = displayMetrics.copy();
} else if (!displayMetrics.equals(mPreviousDisplayMetrics)) {
mPreviousDisplayMetrics = displayMetrics.copy();
mReactApplicationContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)

0 comments on commit 383934a

Please sign in to comment.