use openDrawer in react-navigation v2. Tweak hardware back button behaviour.
This commit is contained in:
parent
8257d7b41d
commit
87a50c494f
1 changed files with 3 additions and 2 deletions
|
@ -58,7 +58,7 @@ const menuNavigationButton = (navigation) => <NavigationButton
|
||||||
size={24}
|
size={24}
|
||||||
style={discoverStyle.drawerMenuButton}
|
style={discoverStyle.drawerMenuButton}
|
||||||
iconStyle={discoverStyle.drawerHamburger}
|
iconStyle={discoverStyle.drawerHamburger}
|
||||||
onPress={() => navigation.navigate('DrawerOpen')} />
|
onPress={() => navigation.openDrawer() } />
|
||||||
|
|
||||||
const discoverStack = createStackNavigator({
|
const discoverStack = createStackNavigator({
|
||||||
Discover: {
|
Discover: {
|
||||||
|
@ -214,7 +214,8 @@ class AppWithNavigationState extends React.Component {
|
||||||
if (nav.routes.length > 0) {
|
if (nav.routes.length > 0) {
|
||||||
if (nav.routes[0].routeName === 'Main') {
|
if (nav.routes[0].routeName === 'Main') {
|
||||||
const mainRoute = nav.routes[0];
|
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.routes[4].index > 0 /* Wallet stack index */ ||
|
||||||
mainRoute.index >= 5 /* Settings and About screens */) {
|
mainRoute.index >= 5 /* Settings and About screens */) {
|
||||||
dispatch(NavigationActions.back());
|
dispatch(NavigationActions.back());
|
||||||
|
|
Loading…
Reference in a new issue