mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make sure that DialogModule is subscribed to LifecycleEventListener events
Summary: I'm not sure what broke this, but in some cases, DialogModule doesn't get subscribed to LifecycleEventListener events. This seems to fix it. Changelog: [Internal] Reviewed By: mdvacca, RSNara Differential Revision: D26856016 fbshipit-source-id: 868baf102b85b202180adcbb8bb181dfe603188f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a206f4fc2e
commit
aa305b34e3
@@ -156,7 +156,7 @@ public class DialogModule extends NativeDialogManagerAndroidSpec implements Life
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
getReactApplicationContext().addLifecycleEventListener(this);
|
||||
getReactApplicationContext().addLifecycleEventListenerAndCheckState(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,4 +240,14 @@ public class DialogModule extends NativeDialogManagerAndroidSpec implements Life
|
||||
}
|
||||
return new FragmentManagerHelper(((FragmentActivity) activity).getSupportFragmentManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCatalystInstanceDestroy() {
|
||||
super.onCatalystInstanceDestroy();
|
||||
|
||||
ReactApplicationContext applicationContext = getReactApplicationContextIfActiveOrWarn();
|
||||
if (applicationContext != null) {
|
||||
applicationContext.removeLifecycleEventListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user