浏览代码

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