Add logging to ReactModalHostView

Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D26752344

fbshipit-source-id: 0cc7987e553896144fadcc8ede8f37f74b4b5bc5
This commit is contained in:
Andrei Shikov 2021-03-02 13:49:32 -08:00 коммит произвёл Facebook GitHub Bot
Родитель caa5abc819
Коммит cbe7c445f7
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -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"),

Просмотреть файл

@ -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();