Преглед на файлове

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

fixes #1162
Guy Carmeli преди 7 години
родител
ревизия
76641526be
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4
    2
      android/app/src/main/java/com/reactnativenavigation/controllers/Modal.java

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/controllers/Modal.java Целия файл

@@ -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