diff --git a/app/src/component/AppNavigator.js b/app/src/component/AppNavigator.js index 402501e..3d21db2 100644 --- a/app/src/component/AppNavigator.js +++ b/app/src/component/AppNavigator.js @@ -79,8 +79,8 @@ const walletStack = StackNavigator({ }); const drawer = DrawerNavigator({ - Discover: { screen: discoverStack }, - Wallet: { screen: walletStack }, + DiscoverStack: { screen: discoverStack }, + WalletStack: { screen: walletStack }, Settings: { screen: SettingsPage, navigationOptions: { drawerLockMode: 'locked-closed' } }, About: { screen: AboutPage, navigationOptions: { drawerLockMode: 'locked-closed' } } }, { @@ -110,16 +110,17 @@ class AppWithNavigationState extends React.Component { BackHandler.addEventListener('hardwareBackPress', function() { const { dispatch, navigation, nav } = this.props; // There should be a better way to check this - if (nav.routes.length > 1) { - const subRoutes = nav.routes[1].routes[0].routes; + if (nav.routes.length > 0) { + const subRoutes = nav.routes[0].routes[0].routes; const lastRoute = subRoutes[subRoutes.length - 1]; - if (['About', 'Settings'].indexOf(lastRoute.key) > -1) { - dispatch({ type: 'Navigation/BACK' }); + if (nav.routes[0].routes[0].index > 0 && + ['About', 'Settings'].indexOf(lastRoute.key) > -1) { + dispatch(NavigationActions.back()); return true; } - if (nav.routes[1].routeName === 'Main') { - if (nav.routes[1].routes[0].routes[0].index > 0) { - dispatch({ type: 'Navigation/BACK' }); + if (nav.routes[0].routeName === 'Main') { + if (nav.routes[0].routes[0].routes[0].index > 0) { + dispatch(NavigationActions.back()); return true; } } diff --git a/app/src/page/splash/view.js b/app/src/page/splash/view.js index 2e2f396..0827092 100644 --- a/app/src/page/splash/view.js +++ b/app/src/page/splash/view.js @@ -1,6 +1,7 @@ import React from 'react'; import { Lbry } from 'lbry-redux'; import { View, Text, NativeModules } from 'react-native'; +import { NavigationActions } from 'react-navigation'; import PropTypes from 'prop-types'; import splashStyle from '../../styles/splash'; @@ -42,7 +43,14 @@ class SplashScreen extends React.PureComponent { // Leave the splash screen const { balanceSubscribe, navigation } = this.props; balanceSubscribe(); - navigation.navigate('Main'); + + const resetAction = NavigationActions.reset({ + index: 0, + actions: [ + NavigationActions.navigate({ routeName: 'Main'}) + ] + }); + navigation.dispatch(resetAction); }); return; }