Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix crash during navigation

Ammar Ahmed565e692af874
diff --git a/apps/mobile/app/navigation/navigation-stack.tsx b/apps/mobile/app/navigation/navigation-stack.tsx
index 556e503ac..af5dbe96c 100644
--- a/apps/mobile/app/navigation/navigation-stack.tsx
+++ b/apps/mobile/app/navigation/navigation-stack.tsx
@@ -261,8 +261,9 @@ export const RootNavigation = () => {
if (useSelectionStore.getState().selectionMode) {
clearSelection();
}
- console.log(state);
- Navigation.resetRootState(state);
+ setTimeout(() => {
+ Navigation.resetRootState(state);
+ }, 1000);
hideAllTooltips();
},
[clearSelection]
diff --git a/apps/mobile/app/services/navigation.ts b/apps/mobile/app/services/navigation.ts
index 1da81e3b3..1ed737d07 100755
--- a/apps/mobile/app/services/navigation.ts
+++ b/apps/mobile/app/services/navigation.ts
@@ -176,13 +176,11 @@ function resetRootState(
const routes = state.routes.filter(
(route) =>
- route.name !== "Auth" &&
- route.name !== "Welcome" &&
- route.key != focusedRoute.key
+ (route.name !== "Auth" && route.name !== "Welcome") ||
+ route.key === focusedRoute.key
);
if (routes.length === state.routes.length) return;
- console.log("ROOT STATE RESET");
if (routes.length === 0) {
routes.push(focusedRoute);
}