diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java index d5d937f8eda..36d69b2dfce 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java @@ -260,6 +260,23 @@ public class SurfaceMountingManager { logViewHierarchy(parentView, false); } + ViewParent viewParent = view.getParent(); + if (viewParent != null) { + int actualParentId = + viewParent instanceof ViewGroup ? ((ViewGroup) viewParent).getId() : View.NO_ID; + ReactSoftException.logSoftException( + TAG, + new IllegalStateException( + "addViewAt: cannot insert view [" + + tag + + "] into parent [" + + parentTag + + "]: View already has a parent: [" + + actualParentId + + "] " + + viewParent.getClass().getSimpleName())); + } + try { getViewGroupManager(parentViewState).addView(parentView, view, index); } catch (IllegalStateException e) {