mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +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:
1 parent
a206f4fc2e
commit
aa305b34e3
1 file changed
+11
-1
@@ -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