Browse Source

Show in app notifications on modals (#866)

Guy Carmeli 7 years ago
parent
commit
1a685073ee

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

@@ -16,6 +16,7 @@ import com.reactnativenavigation.params.ContextualMenuParams;
16 16
 import com.reactnativenavigation.params.FabParams;
17 17
 import com.reactnativenavigation.params.Orientation;
18 18
 import com.reactnativenavigation.params.ScreenParams;
19
+import com.reactnativenavigation.params.SlidingOverlayParams;
19 20
 import com.reactnativenavigation.params.TitleBarButtonParams;
20 21
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
21 22
 
@@ -60,6 +61,14 @@ public class Modal extends Dialog implements DialogInterface.OnDismissListener,
60 61
         layout.dismissContextualMenu(screenInstanceId);
61 62
     }
62 63
 
64
+    void showSlidingOverlay(SlidingOverlayParams params) {
65
+        layout.showSlidingOverlay(params);
66
+    }
67
+
68
+    void hideSlidingOverlay() {
69
+        layout.hideSlidingOverlay();
70
+    }
71
+
63 72
     @Override
64 73
     public boolean onTitleBarBackButtonClick() {
65 74
         if (!layout.onBackPressed()) {

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

@@ -9,6 +9,7 @@ import com.reactnativenavigation.layouts.ScreenStackContainer;
9 9
 import com.reactnativenavigation.params.ContextualMenuParams;
10 10
 import com.reactnativenavigation.params.FabParams;
11 11
 import com.reactnativenavigation.params.ScreenParams;
12
+import com.reactnativenavigation.params.SlidingOverlayParams;
12 13
 import com.reactnativenavigation.params.TitleBarButtonParams;
13 14
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
14 15
 
@@ -150,4 +151,12 @@ class ModalController implements ScreenStackContainer, Modal.OnModalDismissedLis
150 151
     public void onSideMenuButtonClick() {
151 152
         // Do nothing and let the layout handle the click
152 153
     }
154
+
155
+    void showSlidingOverlay(SlidingOverlayParams params) {
156
+        stack.peek().showSlidingOverlay(params);
157
+    }
158
+
159
+    void hideSlidingOverlay() {
160
+        stack.peek().hideSlidingOverlay();
161
+    }
153 162
 }

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

@@ -313,11 +313,19 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
313 313
     }
314 314
 
315 315
     public void showSlidingOverlay(SlidingOverlayParams params) {
316
-        layout.showSlidingOverlay(params);
316
+        if (modalController.isShowing()) {
317
+            modalController.showSlidingOverlay(params);
318
+        } else {
319
+            layout.showSlidingOverlay(params);
320
+        }
317 321
     }
318 322
 
319 323
     public void hideSlidingOverlay() {
320
-        layout.hideSlidingOverlay();
324
+        if (modalController.isShowing()) {
325
+            modalController.hideSlidingOverlay();
326
+        } else {
327
+            layout.hideSlidingOverlay();
328
+        }
321 329
     }
322 330
 
323 331
     public void showSnackbar(SnackbarParams params) {