Skip to content

Commit

Permalink
Merge pull request #121 from software-mansion-labs/poc/fix-navigation…
Browse files Browse the repository at this point in the history
…-after-delete-expense

Fix Search - App returns to Inbox after deleting expense from report …
  • Loading branch information
WojtekBoman authored Oct 29, 2024
2 parents 0f46afb + b9a1119 commit c1d813f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {isEmailPublicDomain} from './LoginUtils';
import ModifiedExpenseMessage from './ModifiedExpenseMessage';
import linkingConfig from './Navigation/linkingConfig';
import Navigation, {navigationRef} from './Navigation/Navigation';
import {isFullScreenName} from './NavigationUtils';
import * as NumberUtils from './NumberUtils';
import Parser from './Parser';
import Permissions from './Permissions';
Expand Down Expand Up @@ -4115,10 +4116,10 @@ function navigateBackAfterDeleteTransaction(backRoute: Route | undefined, isFrom
if (!backRoute) {
return;
}
// @TODO: Verify if this method works correctly

const rootState = navigationRef.current?.getRootState();
const topmostRoute = rootState?.routes.at(-1);
if (topmostRoute?.name === SCREENS.SEARCH.CENTRAL_PANE) {
const lastFullScreenRoute = rootState?.routes.findLast((route) => isFullScreenName(route.name));
if (lastFullScreenRoute?.name === SCREENS.SEARCH.CENTRAL_PANE) {
Navigation.dismissModal();
return;
}
Expand Down

0 comments on commit c1d813f

Please sign in to comment.