From cbe7c445f7a065ec7b79717e6f7bd2dfda06f62f Mon Sep 17 00:00:00 2001 From: Andrei Shikov Date: Tue, 2 Mar 2021 13:49:32 -0800 Subject: [PATCH] Add logging to ReactModalHostView Summary: Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D26752344 fbshipit-source-id: 0cc7987e553896144fadcc8ede8f37f74b4b5bc5 --- .../main/java/com/facebook/react/views/modal/BUCK | 1 + .../react/views/modal/ReactModalHostView.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/BUCK b/ReactAndroid/src/main/java/com/facebook/react/views/modal/BUCK index 73cedfd484b..20c442aef6e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/BUCK @@ -17,6 +17,7 @@ rn_android_library( YOGA_TARGET, react_native_dep("third-party/java/infer-annotations:infer-annotations"), react_native_dep("third-party/java/jsr-305:jsr-305"), + react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"), react_native_root_target("Libraries:generated_components_java-FBReactNativeComponentSpec"), react_native_target("java/com/facebook/react/bridge:bridge"), react_native_target("java/com/facebook/react/common:common"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java index db03bfac47a..32d04e36b45 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java @@ -23,6 +23,7 @@ import android.view.accessibility.AccessibilityEvent; import android.widget.FrameLayout; import androidx.annotation.Nullable; import androidx.annotation.UiThread; +import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.react.R; import com.facebook.react.bridge.GuardedRunnable; @@ -61,6 +62,8 @@ import java.util.ArrayList; public class ReactModalHostView extends ViewGroup implements LifecycleEventListener, FabricViewStateManager.HasFabricViewStateManager { + private static final String TAG = "ReactModalHost"; + // This listener is called when the user presses KeyEvent.KEYCODE_BACK // An event is then passed to JS which can either close or not close the Modal by setting the // visible property @@ -244,6 +247,15 @@ public class ReactModalHostView extends ViewGroup // If the existing Dialog is currently up, we may need to redraw it or we may be able to update // the property without having to recreate the dialog if (mDialog != null) { + Context dialogContext = ContextUtils.findContextOfType(mDialog.getContext(), Activity.class); + // TODO(T85755791): remove after investigation + FLog.e( + TAG, + "Updating existing dialog with context: " + + dialogContext + + "@" + + dialogContext.hashCode()); + if (mPropertyRequiresNewDialog) { dismiss(); } else { @@ -269,6 +281,9 @@ public class ReactModalHostView extends ViewGroup WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); + // TODO(T85755791): remove after investigation + FLog.e(TAG, "Creating new dialog from context: " + context + "@" + context.hashCode()); + mDialog.setContentView(getContentView()); updateProperties();