From 40590348ea7bae50d29f5c677c3c907c0267da57 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 10 Apr 2019 14:06:24 -0700 Subject: [PATCH] Recycle only views created by RN Summary: This diff ensure that only views created by RN are taken into consideration for recycling. Reviewed By: fkgozali Differential Revision: D14874678 fbshipit-source-id: ea7dd5a0f29f6acf0dce8573fc77b012395476bd --- .../facebook/react/fabric/mounting/MountingManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 dc143386b8ee59..c7a2fa5c557294 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 @@ -94,8 +94,11 @@ private void dropView(View view) { mTagToViewState.remove(reactTag); Context context = view.getContext(); - mViewFactory.recycle( - (ThemedReactContext) context, Assertions.assertNotNull(viewManager).getName(), view); + if (context instanceof ThemedReactContext) { + // We only recycle views that were created by RN (its context is instance of ThemedReactContext) + mViewFactory.recycle( + (ThemedReactContext) context, Assertions.assertNotNull(viewManager).getName(), view); + } } /** Releases all references to react root tag. */