|
@@ -7,6 +7,7 @@ import com.reactnativenavigation.utils.RefUtils;
|
7
|
7
|
|
8
|
8
|
import java.lang.ref.WeakReference;
|
9
|
9
|
import java.util.HashMap;
|
|
10
|
+import java.util.Iterator;
|
10
|
11
|
import java.util.Map;
|
11
|
12
|
|
12
|
13
|
/**
|
|
@@ -33,6 +34,10 @@ public class ModalController {
|
33
|
34
|
mModals.put(navigatorId, new WeakReference<>(modal));
|
34
|
35
|
}
|
35
|
36
|
|
|
37
|
+ public boolean isModalDisplayed() {
|
|
38
|
+ return mModals.size() != 0;
|
|
39
|
+ }
|
|
40
|
+
|
36
|
41
|
public boolean isModalDisplayed(String navigatorId) {
|
37
|
42
|
return mModals.size() != 0 && mModals.containsKey(navigatorId);
|
38
|
43
|
}
|
|
@@ -51,4 +56,15 @@ public class ModalController {
|
51
|
56
|
mModals.remove(navigatorId);
|
52
|
57
|
}
|
53
|
58
|
}
|
|
59
|
+
|
|
60
|
+ public void dismissAllModals() {
|
|
61
|
+ Iterator<String> iterator = mModals.keySet().iterator();
|
|
62
|
+ while (iterator.hasNext()) {
|
|
63
|
+ WeakReference<RnnModal> ref = mModals.get(iterator.next());
|
|
64
|
+ RnnModal modal = RefUtils.get(ref);
|
|
65
|
+ if (modal != null) {
|
|
66
|
+ modal.dismiss();
|
|
67
|
+ }
|
|
68
|
+ }
|
|
69
|
+ }
|
54
|
70
|
}
|