ReactModalHostView: Prevent infinite SetState/UpdateState loop

Summary:
Make sure to check incoming state values before calling SetState, or we call back and forth forever.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D23389355

fbshipit-source-id: 9cf6110cf654fe93f555a6fbfd9b20f112214e0a
This commit is contained in:
Joshua Gross authored and Facebook GitHub Bot committed 2020-08-27 20:00:02 -07:00
1 parent ab8b77c3d2
commit e60564215d
2 files changed
+29 -2

No files matched your search

@@ -9,6 +9,7 @@ package com.facebook.react.uimanager;
import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.config.ReactFeatureFlags;
@@ -91,4 +92,8 @@ public class FabricViewStateManager {
public void setState(final StateUpdateCallback stateUpdateCallback) {
setState(mStateWrapper, stateUpdateCallback, 0);
}
public @Nullable ReadableMap getState() {
return mStateWrapper != null ? mStateWrapper.getState() : null;
}
}