Daniel Zlotin 8 years ago
parent
commit
be17b8cc5e

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

99
         layout.newStack(params);
99
         layout.newStack(params);
100
     }
100
     }
101
 
101
 
102
+    public boolean containsNavigator(String navigatorId) {
103
+        return layout.containsNavigator(navigatorId);
104
+    }
105
+
102
     @Override
106
     @Override
103
     public void destroy() {
107
     public void destroy() {
104
         layout.destroy();
108
         layout.destroy();

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

20
         this.activity = activity;
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
     public void showModal(ScreenParams screenParams) {
32
     public void showModal(ScreenParams screenParams) {
24
         Modal modal = new Modal(activity, this, screenParams);
33
         Modal modal = new Modal(activity, this, screenParams);
25
         modal.show();
34
         modal.show();

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

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

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

198
         EventBus.instance.post(new ScreenChangedEvent(getCurrentScreenStack().peek().getScreenParams()));
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
     public void selectBottomTabByTabIndex(Integer index) {
207
     public void selectBottomTabByTabIndex(Integer index) {
202
         bottomTabs.setCurrentItem(index);
208
         bottomTabs.setCurrentItem(index);
203
     }
209
     }

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

30
     void showSnackbar(SnackbarParams params);
30
     void showSnackbar(SnackbarParams params);
31
 
31
 
32
     void onModalDismissed();
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
         EventBus.instance.post(new ScreenChangedEvent(stack.peek().getScreenParams()));
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
     @Override
206
     @Override
202
     public boolean onTitleBarBackButtonClick() {
207
     public boolean onTitleBarBackButtonClick() {
203
         if (leftButtonOnClickListener != null) {
208
         if (leftButtonOnClickListener != null) {

+ 1
- 1
package.json View File

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