1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Android: Fixes #11324: Fix sharing to Joplin causes back navigation to get stuck (#11355)

This commit is contained in:
Henry Heino
2024-11-09 04:54:09 -08:00
committed by GitHub
parent 0876086caa
commit a08ebb9ce5
5 changed files with 29 additions and 18 deletions

View File

@@ -36,6 +36,7 @@ const DropdownAlert = require('react-native-dropdownalert').default;
const AlarmServiceDriver = require('./services/AlarmServiceDriver').default;
const SafeAreaView = require('./components/SafeAreaView');
const { connect, Provider } = require('react-redux');
import fastDeepEqual = require('fast-deep-equal');
import { Provider as PaperProvider, MD3DarkTheme, MD3LightTheme } from 'react-native-paper';
import BackButtonService from './services/BackButtonService';
import NavService from '@joplin/lib/services/NavService';
@@ -89,6 +90,8 @@ import JoplinCloudLoginScreen from './components/screens/JoplinCloudLoginScreen'
import SyncTargetNone from '@joplin/lib/SyncTargetNone';
SyncTargetRegistry.addClass(SyncTargetNone);
SyncTargetRegistry.addClass(SyncTargetOneDrive);
SyncTargetRegistry.addClass(SyncTargetNextcloud);
@@ -301,7 +304,18 @@ const appReducer = (state = appDefaultState, action: any) => {
const currentRoute = state.route;
if (!historyGoingBack && historyCanGoBackTo(currentRoute)) {
navHistory.push(currentRoute);
const previousRoute = navHistory.length && navHistory[navHistory.length - 1];
const isDifferentRoute = !previousRoute || !fastDeepEqual(navHistory[navHistory.length - 1], currentRoute);
// Avoid multiple consecutive duplicate screens in the navigation history -- these can make
// pressing "back" seem to have no effect.
if (isDifferentRoute) {
navHistory.push(currentRoute);
}
}
if (action.clearHistory) {
navHistory.splice(0, navHistory.length);
}
newState = { ...state };