From 87a50c494fc455cc9a3b08dbeff756feccc682f5 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 2 Sep 2018 08:32:09 +0100 Subject: [PATCH] use openDrawer in react-navigation v2. Tweak hardware back button behaviour. --- app/src/component/AppNavigator.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/component/AppNavigator.js b/app/src/component/AppNavigator.js index fe7b1ca..6d8680c 100644 --- a/app/src/component/AppNavigator.js +++ b/app/src/component/AppNavigator.js @@ -58,7 +58,7 @@ const menuNavigationButton = (navigation) => navigation.navigate('DrawerOpen')} /> + onPress={() => navigation.openDrawer() } /> const discoverStack = createStackNavigator({ Discover: { @@ -214,7 +214,8 @@ class AppWithNavigationState extends React.Component { if (nav.routes.length > 0) { if (nav.routes[0].routeName === 'Main') { const mainRoute = nav.routes[0]; - if (mainRoute.routes[0].index > 0 /* Discover stack index */ || + if (mainRoute.index > 0 || + mainRoute.routes[0].index > 0 /* Discover stack index */ || mainRoute.routes[4].index > 0 /* Wallet stack index */ || mainRoute.index >= 5 /* Settings and About screens */) { dispatch(NavigationActions.back());