Clean listeners during destroy of ReactContext

Summary:
This diff cleans listeners on the destruction of the ReactContext.

changelog: [inernal] internal

Reviewed By: JoshuaGross

Differential Revision: D26259929

fbshipit-source-id: 1843cabdac2fa3e67dcc890afd923b82472d8f66
This commit is contained in:
David Vacca authored and Facebook GitHub Bot committed 2021-02-06 23:05:28 -08:00
1 parent 98165a23f6
commit d79212120b
5 files changed
+22 -4

No files matched your search

@@ -247,8 +247,11 @@ public class UIManagerModule extends ReactContextBaseJavaModule
mEventDispatcher.onCatalystInstanceDestroyed();
mUIImplementation.onCatalystInstanceDestroyed();
getReactApplicationContext().removeLifecycleEventListener(this);
getReactApplicationContext().unregisterComponentCallbacks(mMemoryTrimCallback);
ReactApplicationContext reactApplicationContext = getReactApplicationContext();
if (ReactFeatureFlags.enableReactContextCleanupFix) {
reactApplicationContext.removeLifecycleEventListener(this);
}
reactApplicationContext.unregisterComponentCallbacks(mMemoryTrimCallback);
YogaNodePool.get().clear();
ViewManagerPropertyUpdater.clear();
}