Browse 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 8 years ago
parent
commit
8ddd52b298

+ 2
- 3
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java View File

382
 
382
 
383
     @Override
383
     @Override
384
     public void onSideMenuButtonClick() {
384
     public void onSideMenuButtonClick() {
385
+        final String navigatorEventId = getCurrentScreenStack().peek().getNavigatorEventId();
386
+        NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);
385
         if (sideMenu != null) {
387
         if (sideMenu != null) {
386
             sideMenu.openDrawer(Side.Left);
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 View File

242
 
242
 
243
     @Override
243
     @Override
244
     public void onSideMenuButtonClick() {
244
     public void onSideMenuButtonClick() {
245
+        final String navigatorEventId = stack.peek().getNavigatorEventId();
246
+        NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);
245
         if (sideMenu != null) {
247
         if (sideMenu != null) {
246
             sideMenu.openDrawer(Side.Left);
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
 }