Skip to content

Commit

Permalink
Don't emit dimensions update event on initial load
Browse files Browse the repository at this point in the history
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 383934a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 383934a

Please sign in to comment.