Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,6 @@ function popRootToTop() {
navigationRef.current?.dispatch({...StackActions.popToTop(), target: rootState.key});
}

function pop(target: string) {
navigationRef.current?.dispatch({...StackActions.pop(), target});
}

function removeScreenFromNavigationState(screen: string) {
isNavigationReady().then(() => {
navigationRef.current?.dispatch((state) => {
Expand Down Expand Up @@ -656,7 +652,6 @@ export default {
setNavigationActionToMicrotaskQueue,
popToTop,
popRootToTop,
pop,
removeScreenFromNavigationState,
removeScreenByKey,
getReportRouteByID,
Expand Down
12 changes: 1 addition & 11 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ import isFileUploadable from '@libs/isFileUploadable';
import {formatPhoneNumber} from '@libs/LocalePhoneNumber';
import * as Localize from '@libs/Localize';
import Log from '@libs/Log';
import isReportOpenInRHP from '@libs/Navigation/helpers/isReportOpenInRHP';
import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute';
import Navigation, {navigationRef} from '@libs/Navigation/Navigation';
import Navigation from '@libs/Navigation/Navigation';
import {buildNextStep} from '@libs/NextStepUtils';
import * as NumberUtils from '@libs/NumberUtils';
import {getManagerMcTestParticipant, getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils';
Expand Down Expand Up @@ -841,18 +840,9 @@ Onyx.connect({
/**
* @private
* After finishing the action in RHP from the Inbox tab, besides dismissing the modal, we should open the report.
* If the action is done from the report RHP, then we just want to dismiss the money request flow screens.
* It is a helper function used only in this file.
*/
function dismissModalAndOpenReportInInboxTab(reportID?: string) {
const rootState = navigationRef.getRootState();
if (isReportOpenInRHP(rootState)) {
const rhpKey = rootState.routes.at(-1)?.state?.key;
if (rhpKey) {
Navigation.pop(rhpKey);
return;
}
}
if (isSearchTopmostFullScreenRoute() || !reportID) {
Navigation.dismissModal();
return;
Expand Down
9 changes: 6 additions & 3 deletions tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ jest.mock('@src/libs/Navigation/Navigation', () => ({
getReportRouteByID: jest.fn(),
getActiveRouteWithoutParams: jest.fn(),
getActiveRoute: jest.fn(),
navigationRef: {
getRootState: jest.fn(),
},
}));

jest.mock('@src/libs/Navigation/navigationRef', () => ({
getRootState: () => ({
routes: [],
}),
}));

jest.mock('@react-navigation/native');
Expand Down
Loading