Parcourir la source

Sends a nav event whenever the sideMenu button is clicked. (Android) (#617)

* Dispatch a navigation event whenever the side menu button is clicked (BottomTabsLayout)

* Dispatch a navigation event whenever the side menu button is clicked (SingleScreenLayout)

* Changed the way the navigatorEventId is retrieved in SingleScreenLayout.
Ioannis Kokkinidis il y a 8 ans
Parent
révision
8ddd52b298

+ 2
- 3
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java Voir le fichier

@@ -382,11 +382,10 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
382 382
 
383 383
     @Override
384 384
     public void onSideMenuButtonClick() {
385
+        final String navigatorEventId = getCurrentScreenStack().peek().getNavigatorEventId();
386
+        NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);
385 387
         if (sideMenu != null) {
386 388
             sideMenu.openDrawer(Side.Left);
387
-        } else {
388
-            final String navigatorEventId = getCurrentScreenStack().peek().getNavigatorEventId();
389
-            NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);
390 389
         }
391 390
     }
392 391
 }

+ 2
- 3
android/app/src/main/java/com/reactnativenavigation/layouts/SingleScreenLayout.java Voir le fichier

@@ -242,11 +242,10 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
242 242
 
243 243
     @Override
244 244
     public void onSideMenuButtonClick() {
245
+        final String navigatorEventId = stack.peek().getNavigatorEventId();
246
+        NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);
245 247
         if (sideMenu != null) {
246 248
             sideMenu.openDrawer(Side.Left);
247
-        } else {
248
-            final String navigatorEventId = stack.peek().getNavigatorEventId();
249
-            NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);
250 249
         }
251 250
     }
252 251
 }