Skip to content

Commit 4059034

Browse files
mdvaccafacebook-github-bot
authored andcommitted
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
1 parent 66492e7 commit 4059034

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,11 @@ private void dropView(View view) {
9494

9595
mTagToViewState.remove(reactTag);
9696
Context context = view.getContext();
97-
mViewFactory.recycle(
98-
(ThemedReactContext) context, Assertions.assertNotNull(viewManager).getName(), view);
97+
if (context instanceof ThemedReactContext) {
98+
// We only recycle views that were created by RN (its context is instance of ThemedReactContext)
99+
mViewFactory.recycle(
100+
(ThemedReactContext) context, Assertions.assertNotNull(viewManager).getName(), view);
101+
}
99102
}
100103

101104
/** Releases all references to react root tag. */

0 commit comments

Comments
 (0)