Daniel Zlotin 8 years ago
parent
commit
be17b8cc5e

+ 4
- 0
android/app/src/main/java/com/reactnativenavigation/controllers/Modal.java View File

@@ -99,6 +99,10 @@ public class Modal extends Dialog implements DialogInterface.OnDismissListener,
99 99
         layout.newStack(params);
100 100
     }
101 101
 
102
+    public boolean containsNavigator(String navigatorId) {
103
+        return layout.containsNavigator(navigatorId);
104
+    }
105
+
102 106
     @Override
103 107
     public void destroy() {
104 108
         layout.destroy();

+ 9
- 0
android/app/src/main/java/com/reactnativenavigation/controllers/ModalController.java View File

@@ -20,6 +20,15 @@ public class ModalController implements ScreenStackContainer, Modal.OnModalDismi
20 20
         this.activity = activity;
21 21
     }
22 22
 
23
+    public boolean containsNavigator(String navigatorId) {
24
+        for (Modal modal : stack) {
25
+            if (modal.containsNavigator(navigatorId)) {
26
+                return true;
27
+            }
28
+        }
29
+        return false;
30
+    }
31
+
23 32
     public void showModal(ScreenParams screenParams) {
24 33
         Modal modal = new Modal(activity, this, screenParams);
25 34
         modal.show();

+ 4
- 4
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java View File

@@ -136,7 +136,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
136 136
     }
137 137
 
138 138
     void push(ScreenParams params) {
139
-        if (modalController.isShowing()) {
139
+        if (modalController.containsNavigator(params.getNavigatorId())) {
140 140
             modalController.push(params);
141 141
         } else {
142 142
             layout.push(params);
@@ -144,7 +144,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
144 144
     }
145 145
 
146 146
     void pop(ScreenParams params) {
147
-        if (modalController.isShowing()) {
147
+        if (modalController.containsNavigator(params.getNavigatorId())) {
148 148
             modalController.pop(params);
149 149
         } else {
150 150
             layout.pop(params);
@@ -152,7 +152,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
152 152
     }
153 153
 
154 154
     void popToRoot(ScreenParams params) {
155
-        if (modalController.isShowing()) {
155
+        if (modalController.containsNavigator(params.getNavigatorId())) {
156 156
             modalController.popToRoot(params);
157 157
         } else {
158 158
             layout.popToRoot(params);
@@ -160,7 +160,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
160 160
     }
161 161
 
162 162
     void newStack(ScreenParams params) {
163
-        if (modalController.isShowing()) {
163
+        if (modalController.containsNavigator(params.getNavigatorId())) {
164 164
             modalController.newStack(params);
165 165
         } else {
166 166
             layout.newStack(params);

+ 6
- 0
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java View File

@@ -198,6 +198,12 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
198 198
         EventBus.instance.post(new ScreenChangedEvent(getCurrentScreenStack().peek().getScreenParams()));
199 199
     }
200 200
 
201
+    @Override
202
+    public boolean containsNavigator(String navigatorId) {
203
+        // Unused
204
+        return false;
205
+    }
206
+
201 207
     public void selectBottomTabByTabIndex(Integer index) {
202 208
         bottomTabs.setCurrentItem(index);
203 209
     }

+ 2
- 0
android/app/src/main/java/com/reactnativenavigation/layouts/Layout.java View File

@@ -30,4 +30,6 @@ public interface Layout extends ScreenStackContainer {
30 30
     void showSnackbar(SnackbarParams params);
31 31
 
32 32
     void onModalDismissed();
33
+
34
+    boolean containsNavigator(String navigatorId);
33 35
 }

+ 5
- 0
android/app/src/main/java/com/reactnativenavigation/layouts/SingleScreenLayout.java View File

@@ -198,6 +198,11 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
198 198
         EventBus.instance.post(new ScreenChangedEvent(stack.peek().getScreenParams()));
199 199
     }
200 200
 
201
+    @Override
202
+    public boolean containsNavigator(String navigatorId) {
203
+        return stack.getNavigatorId().equals(navigatorId);
204
+    }
205
+
201 206
     @Override
202 207
     public boolean onTitleBarBackButtonClick() {
203 208
         if (leftButtonOnClickListener != null) {

+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-navigation",
3
-  "version": "2.0.0-experimental.110",
3
+  "version": "2.0.0-experimental.111",
4 4
   "description": "React Native Navigation - truly native navigation for iOS and Android",
5 5
   "license": "MIT",
6 6
   "nativePackage": true,