From 9817f85defe3cc900a66dee968b446223a0aa11c Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 12 Oct 2018 18:36:41 -0700 Subject: [PATCH] Avoid cleaning up ReactRootView content when reactContext is destroyed Summary: This diff avoids deleting all the views of ReactRootView when the ReactContext is destroyed (ONLY FOR FABRIC). In Fabric these views are removed and deleted by the framework when the ReactShadowNode is destroyed. Reviewed By: shergin Differential Revision: D10319737 fbshipit-source-id: 2e2d2599006cd8205e0153c18cd75383387ce1df --- .../main/java/com/facebook/react/ReactInstanceManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index 6402c9dbe..cf1600656 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -1073,7 +1073,11 @@ public class ReactInstanceManager { synchronized (mAttachedRootViews) { for (ReactRootView rootView : mAttachedRootViews) { - rootView.removeAllViews(); + if (rootView.getUIManagerType() != FABRIC) { + // All the views created in surfaces that are managed by Fabric, are removed and deleted + // by the Mounting Layer. + rootView.removeAllViews(); + } rootView.setId(View.NO_ID); } }