You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Improved nav
This commit is contained in:
@@ -59,11 +59,14 @@ const reducer = (state = defaultState, action) => {
|
||||
|
||||
case 'Navigation/BACK':
|
||||
|
||||
if (!navHistory.length) break;
|
||||
if (navHistory.length < 2) break;
|
||||
|
||||
action = navHistory.pop(); // Current page
|
||||
if (!navHistory.length) break;
|
||||
action = navHistory.pop(); // Previous page
|
||||
|
||||
// newState = Object.assign({}, state);
|
||||
// newState.historyCanGoBack = false;
|
||||
|
||||
// Fall throught
|
||||
|
||||
case 'Navigation/NAVIGATE':
|
||||
@@ -98,7 +101,6 @@ const reducer = (state = defaultState, action) => {
|
||||
if (currentRouteName == action.routeName) {
|
||||
// If the current screen is already the requested screen, don't do anything
|
||||
} else {
|
||||
//const nextStateNav = AppNavigator.router.getStateForAction(action, currentRouteName != 'Loading' ? state.nav : null);
|
||||
const nextStateNav = AppNavigator.router.getStateForAction(action, state.nav);
|
||||
if (nextStateNav) {
|
||||
newState.nav = nextStateNav;
|
||||
@@ -106,6 +108,10 @@ const reducer = (state = defaultState, action) => {
|
||||
}
|
||||
}
|
||||
|
||||
newState.historyCanGoBack = navHistory.length >= 2;
|
||||
|
||||
console.info(navHistory.length, newState.historyCanGoBack);
|
||||
|
||||
break;
|
||||
|
||||
// Replace all the notes with the provided array
|
||||
@@ -203,10 +209,6 @@ const reducer = (state = defaultState, action) => {
|
||||
|
||||
}
|
||||
|
||||
if (action.type == 'Navigation/NAVIGATE' || action.type == 'Navigation/BACK') {
|
||||
newState.historyCanGoBack = !!navHistory.length;
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user