mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make sure that TimingModule is subscribed to LifecycleEventListener events, and unsubscribes in onCatalystInstanceDestroy
Summary: If modules are *not* eagerly init'd and expect lifecycle events, make sure (1) onHostResume is called immediately it it's currently active and (2) that listeners are removed in onCatalystInstanceDestroy. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D26859160 fbshipit-source-id: ce84deafd1f20d1680d333d1a176b0493623a4ee
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c2e44103b9
commit
77a23bdf0f
@@ -130,10 +130,13 @@ public final class TimingModule extends NativeTimingSpec
|
||||
|
||||
@Override
|
||||
public void onCatalystInstanceDestroy() {
|
||||
ReactApplicationContext reactApplicationContext = getReactApplicationContext();
|
||||
|
||||
HeadlessJsTaskContext headlessJsTaskContext =
|
||||
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
|
||||
HeadlessJsTaskContext.getInstance(reactApplicationContext);
|
||||
headlessJsTaskContext.removeTaskEventListener(this);
|
||||
mJavaTimerManager.onInstanceDestroy();
|
||||
reactApplicationContext.removeLifecycleEventListener(this);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
Reference in New Issue
Block a user