diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java index 0285ab161..42f9389bd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java @@ -363,6 +363,11 @@ public class FlatUIImplementation extends UIImplementation { * and drops all Views used by it and its children. */ private void removeChild(ReactShadowNode child, ReactShadowNode parentNode) { + dropNativeViews(child, parentNode); + removeShadowNode(child); + } + + private void dropNativeViews(ReactShadowNode child, ReactShadowNode parentNode) { if (child instanceof FlatShadowNode) { FlatShadowNode node = (FlatShadowNode) child; if (node.mountsToView() && node.isBackingViewCreated()) { @@ -388,16 +393,13 @@ public class FlatUIImplementation extends UIImplementation { // this will recursively drop all subviews mStateBuilder.dropView(node, tag); - removeShadowNode(node); return; } } for (int i = 0, childCount = child.getChildCount(); i != childCount; ++i) { - removeChild(child.getChildAt(i), child); + dropNativeViews(child.getChildAt(i), child); } - - removeShadowNode(child); } /**