From 0aa8ed6361e981c509cb8370e2b404c08a3bc83d Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Tue, 30 Jun 2020 22:03:38 -0700 Subject: [PATCH] Remove useless Mounting diagnostic error Summary: While in theory we should never delete views before removing them from the hierarchy, there are some exceptions: (1) Some mysterious cases that don't seem like bugs, but where the child still seems to keep a reference to the parent: (2) When deleting views as part of stopSurface. On #1: in the past we had issues when we assumed that ViewManager.getChildCount() would return an accurate count. Sometimes it's just... wrong. Here, I've found at least one case where a View still has a parent after it's removed from the View hierarchy. I assume this is undocumented Android behavior or an Android bug, but either way, there's nothing I can do about it. On #2: there are valid cases where we want to delete a View without explicitly removing it from the View hierarchy (it will eventually be removed from the hierarchy when the Root view is unmounted, but it may still be "in" a View hierarchy when it's deleted). Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D22321374 fbshipit-source-id: 9667bbe778c418f0216550638dc26ca48a58e5fa --- .../facebook/react/fabric/mounting/MountingManager.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java index 47d6582698f53b..3c33450fc14860 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java @@ -455,15 +455,6 @@ public void deleteView(int reactTag) { View view = viewState.mView; if (view != null) { - ViewParent parentView = view.getParent(); - - if (parentView != null) { - ReactSoftException.logSoftException( - TAG, - new IllegalStateException( - "Warning: Deleting view that is still attached to parent: [" + reactTag + "]")); - } - dropView(view); } else { mTagToViewState.remove(reactTag);