Parcourir la source

Send modal lifecycle events only if modal is not destroyed (#1166)

fixes #1162
Guy Carmeli il y a 7 ans
Parent
révision
76641526be

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/controllers/Modal.java Voir le fichier

@@ -172,8 +172,10 @@ public class Modal extends Dialog implements DialogInterface.OnDismissListener,
172 172
 
173 173
     @Override
174 174
     public void dismiss() {
175
-        NavigationApplication.instance.getEventEmitter().sendScreenChangedEvent("willDisappear", layout.getCurrentScreen().getNavigatorEventId());
176
-        NavigationApplication.instance.getEventEmitter().sendScreenChangedEvent("didDisappear", layout.getCurrentScreen().getNavigatorEventId());
175
+        if (!isDestroyed) {
176
+            NavigationApplication.instance.getEventEmitter().sendScreenChangedEvent("willDisappear", layout.getCurrentScreen().getNavigatorEventId());
177
+            NavigationApplication.instance.getEventEmitter().sendScreenChangedEvent("didDisappear", layout.getCurrentScreen().getNavigatorEventId());
178
+        }
177 179
         super.dismiss();
178 180
     }
179 181