@@ -16,19 +16,21 @@ import ONYXKEYS from '@src/ONYXKEYS';
1616import ROUTES from '@src/ROUTES' ;
1717import type SCREENS from '@src/SCREENS' ;
1818
19- type TransactionReceiptProps = PlatformStackScreenProps < AuthScreensParamList , typeof SCREENS . TRANSACTION_RECEIPT > ;
19+ type TransactionReceiptProps = PlatformStackScreenProps < AuthScreensParamList , typeof SCREENS . TRANSACTION_RECEIPT | typeof SCREENS . MONEY_REQUEST . RECEIPT_PREVIEW > ;
2020
2121function TransactionReceipt ( { route} : TransactionReceiptProps ) {
2222 const reportID = route . params . reportID ;
2323 const transactionID = route . params . transactionID ;
24- const action = route . params . action ;
24+ const action = 'action' in route . params ? route . params . action : undefined ;
25+ const iouType = 'iouType' in route . params ? route . params . iouType : undefined ;
2526 const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` , { canBeMissing : true } ) ;
2627 const [ transactionMain ] = useOnyx ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ transactionID } ` , { canBeMissing : true } ) ;
2728 const [ transactionDraft ] = useOnyx ( `${ ONYXKEYS . COLLECTION . TRANSACTION_DRAFT } ${ transactionID } ` , { canBeMissing : true } ) ;
2829 const [ reportMetadata = CONST . DEFAULT_REPORT_METADATA ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_METADATA } ${ reportID } ` , { canBeMissing : true } ) ;
2930
3031 // If we have a merge transaction, we need to use the receipt from the merge transaction
31- const mergeTransactionID = route . params . mergeTransactionID ;
32+ const mergeTransactionID = 'mergeTransactionID' in route . params ? route . params . mergeTransactionID : undefined ;
33+ const isFromReviewDuplicates = 'isFromReviewDuplicates' in route . params ? route . params . isFromReviewDuplicates === 'true' : undefined ;
3234 const [ mergeTransaction ] = useOnyx ( `${ ONYXKEYS . COLLECTION . MERGE_TRANSACTION } ${ mergeTransactionID } ` , { canBeMissing : true } ) ;
3335 if ( mergeTransactionID && mergeTransaction && transactionMain ) {
3436 transactionMain . receipt = mergeTransaction . receipt ;
@@ -39,15 +41,13 @@ function TransactionReceipt({route}: TransactionReceiptProps) {
3941 const receiptURIs = getThumbnailAndImageURIs ( transaction ) ;
4042 const isLocalFile = receiptURIs . isLocalFile ;
4143 const readonly = route . params . readonly === 'true' ;
42- const isFromReviewDuplicates = route . params . isFromReviewDuplicates === 'true' ;
4344 const imageSource = isDraftTransaction ? transactionDraft ?. receipt ?. source : tryResolveUrlFromApiRoot ( receiptURIs . image ?? '' ) ;
4445
4546 const parentReportAction = getReportAction ( report ?. parentReportID , report ?. parentReportActionID ) ;
4647 const canEditReceipt = canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT ) ;
4748 const canDeleteReceipt = canEditFieldOfMoneyRequest ( parentReportAction , CONST . EDIT_REQUEST_FIELD . RECEIPT , true ) ;
4849 const isEReceipt = transaction && ! hasReceiptSource ( transaction ) && hasEReceipt ( transaction ) ;
4950 const isTrackExpenseAction = isTrackExpenseReportReportActionsUtils ( parentReportAction ) ;
50- const iouType = route . params . iouType ;
5151
5252 useEffect ( ( ) => {
5353 if ( ( ! ! report && ! ! transaction ) || isDraftTransaction ) {
0 commit comments