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 05438adaf07..7d89e34ebf7 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 @@ -242,7 +242,9 @@ public class MountingManager { throw new IllegalStateException("Unable to find view for tag " + parentTag); } - if (parentView.getChildCount() <= index) { + ViewGroupManager viewGroupManager = getViewGroupManager(viewState); + + if (viewGroupManager.getChildCount(parentView) <= index) { throw new IllegalStateException( "Cannot remove child at index " + index @@ -253,7 +255,7 @@ public class MountingManager { + " children in parent"); } - getViewGroupManager(viewState).removeViewAt(parentView, index); + viewGroupManager.removeViewAt(parentView, index); } @UiThread