Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] [Navigation] Per Diem - After selecting Dates, the flow goes back to the country list page #56833

Merged
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
2 changes: 1 addition & 1 deletion src/components/MoneyRequestConfirmationListFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ function MoneyRequestConfirmationListFooter({
if (!transactionID) {
return;
}
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_TIME_EDIT.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRoute()));
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_TIME_EDIT.getRoute(action, iouType, transactionID, reportID));
}}
disabled={didConfirm}
interactive={!isReadOnly}
Expand Down
13 changes: 10 additions & 3 deletions src/pages/iou/request/step/IOURequestStepTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {getIOURequestPolicyID, setMoneyRequestDateAttribute} from '@userActions/
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import SCREENS from '@src/SCREENS';
import INPUT_IDS from '@src/types/form/MoneyRequestTimeForm';
import type * as OnyxTypes from '@src/types/onyx';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
Expand All @@ -26,7 +26,7 @@ import withFullTransactionOrNotFound from './withFullTransactionOrNotFound';
import type {WithWritableReportOrNotFoundProps} from './withWritableReportOrNotFound';
import withWritableReportOrNotFound from './withWritableReportOrNotFound';

type IOURequestStepTimeProps = WithWritableReportOrNotFoundProps<typeof SCREENS.MONEY_REQUEST.STEP_TIME> & {
type IOURequestStepTimeProps = WithWritableReportOrNotFoundProps<typeof SCREENS.MONEY_REQUEST.STEP_TIME | typeof SCREENS.MONEY_REQUEST.STEP_TIME_EDIT> & {
/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
transaction: OnyxEntry<OnyxTypes.Transaction>;

Expand All @@ -37,6 +37,7 @@ type IOURequestStepTimeProps = WithWritableReportOrNotFoundProps<typeof SCREENS.
function IOURequestStepTime({
route: {
params: {action, iouType, reportID, transactionID, backTo},
name,
},
transaction,
report,
Expand All @@ -49,8 +50,14 @@ function IOURequestStepTime({
const currentEndDate = currentDateAttributes?.end ? DateUtils.extractDate(currentDateAttributes.end) : undefined;
// eslint-disable-next-line rulesdir/no-negated-variables
const shouldShowNotFound = !isValidMoneyRequestType(iouType) || isEmptyObject(transaction?.comment?.customUnit) || isEmptyObject(policy);
const isEditPage = name === SCREENS.MONEY_REQUEST.STEP_TIME_EDIT;

const navigateBack = () => {
if (isEditPage) {
Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, iouType, transactionID, reportID));
return;
}

if (backTo) {
Navigation.goBack(backTo);
return;
Expand Down Expand Up @@ -78,7 +85,7 @@ function IOURequestStepTime({

setMoneyRequestDateAttribute(transactionID, newStart, newEnd);

if (backTo) {
if (isEditPage) {
navigateBack();
} else {
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_SUBRATE.getRoute(action, iouType, transactionID, reportID));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import {useOnyx} from 'react-native-onyx';
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
import getComponentDisplayName from '@libs/getComponentDisplayName';
import * as IOUUtils from '@libs/IOUUtils';

Check failure on line 8 in src/pages/iou/request/step/withFullTransactionOrNotFound.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {MoneyRequestNavigatorParamList} from '@libs/Navigation/types';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -43,6 +43,7 @@
| typeof SCREENS.MONEY_REQUEST.STEP_COMPANY_INFO
| typeof SCREENS.MONEY_REQUEST.STEP_DESTINATION
| typeof SCREENS.MONEY_REQUEST.STEP_TIME
| typeof SCREENS.MONEY_REQUEST.STEP_TIME_EDIT
| typeof SCREENS.MONEY_REQUEST.STEP_SUBRATE;

type WithFullTransactionOrNotFoundProps<RouteName extends MoneyRequestRouteName> = WithFullTransactionOrNotFoundOnyxProps &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import getComponentDisplayName from '@libs/getComponentDisplayName';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {MoneyRequestNavigatorParamList} from '@libs/Navigation/types';
import * as ReportUtils from '@libs/ReportUtils';

Check failure on line 10 in src/pages/iou/request/step/withWritableReportOrNotFound.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as ReportActions from '@userActions/Report';

Check failure on line 11 in src/pages/iou/request/step/withWritableReportOrNotFound.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@userActions/module"
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type SCREENS from '@src/SCREENS';
Expand Down Expand Up @@ -45,6 +45,7 @@
| typeof SCREENS.MONEY_REQUEST.STEP_UPGRADE
| typeof SCREENS.MONEY_REQUEST.STEP_DESTINATION
| typeof SCREENS.MONEY_REQUEST.STEP_TIME
| typeof SCREENS.MONEY_REQUEST.STEP_TIME_EDIT
| typeof SCREENS.MONEY_REQUEST.STEP_SUBRATE;

type WithWritableReportOrNotFoundProps<RouteName extends MoneyRequestRouteName> = WithWritableReportOrNotFoundOnyxProps & PlatformStackScreenProps<MoneyRequestNavigatorParamList, RouteName>;
Expand Down
Loading