@@ -17,7 +17,7 @@ import {getIOURequestPolicyID, setMoneyRequestDateAttribute} from '@userActions/
17
17
import CONST from '@src/CONST' ;
18
18
import ONYXKEYS from '@src/ONYXKEYS' ;
19
19
import ROUTES from '@src/ROUTES' ;
20
- import type SCREENS from '@src/SCREENS' ;
20
+ import SCREENS from '@src/SCREENS' ;
21
21
import INPUT_IDS from '@src/types/form/MoneyRequestTimeForm' ;
22
22
import type * as OnyxTypes from '@src/types/onyx' ;
23
23
import { isEmptyObject } from '@src/types/utils/EmptyObject' ;
@@ -26,7 +26,7 @@ import withFullTransactionOrNotFound from './withFullTransactionOrNotFound';
26
26
import type { WithWritableReportOrNotFoundProps } from './withWritableReportOrNotFound' ;
27
27
import withWritableReportOrNotFound from './withWritableReportOrNotFound' ;
28
28
29
- type IOURequestStepTimeProps = WithWritableReportOrNotFoundProps < typeof SCREENS . MONEY_REQUEST . STEP_TIME > & {
29
+ type IOURequestStepTimeProps = WithWritableReportOrNotFoundProps < typeof SCREENS . MONEY_REQUEST . STEP_TIME | typeof SCREENS . MONEY_REQUEST . STEP_TIME_EDIT > & {
30
30
/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
31
31
transaction : OnyxEntry < OnyxTypes . Transaction > ;
32
32
@@ -37,6 +37,7 @@ type IOURequestStepTimeProps = WithWritableReportOrNotFoundProps<typeof SCREENS.
37
37
function IOURequestStepTime ( {
38
38
route : {
39
39
params : { action, iouType, reportID, transactionID, backTo} ,
40
+ name,
40
41
} ,
41
42
transaction,
42
43
report,
@@ -49,8 +50,14 @@ function IOURequestStepTime({
49
50
const currentEndDate = currentDateAttributes ?. end ? DateUtils . extractDate ( currentDateAttributes . end ) : undefined ;
50
51
// eslint-disable-next-line rulesdir/no-negated-variables
51
52
const shouldShowNotFound = ! isValidMoneyRequestType ( iouType ) || isEmptyObject ( transaction ?. comment ?. customUnit ) || isEmptyObject ( policy ) ;
53
+ const isEditPage = name === SCREENS . MONEY_REQUEST . STEP_TIME_EDIT ;
52
54
53
55
const navigateBack = ( ) => {
56
+ if ( isEditPage ) {
57
+ Navigation . goBack ( ROUTES . MONEY_REQUEST_STEP_CONFIRMATION . getRoute ( action , iouType , transactionID , reportID ) ) ;
58
+ return ;
59
+ }
60
+
54
61
if ( backTo ) {
55
62
Navigation . goBack ( backTo ) ;
56
63
return ;
@@ -78,7 +85,7 @@ function IOURequestStepTime({
78
85
79
86
setMoneyRequestDateAttribute ( transactionID , newStart , newEnd ) ;
80
87
81
- if ( backTo ) {
88
+ if ( isEditPage ) {
82
89
navigateBack ( ) ;
83
90
} else {
84
91
Navigation . navigate ( ROUTES . MONEY_REQUEST_STEP_SUBRATE . getRoute ( action , iouType , transactionID , reportID ) ) ;
0 commit comments