@@ -11,6 +11,7 @@ import useLocalize from '@hooks/useLocalize';
1111import useNetwork from '@hooks/useNetwork' ;
1212import useOnyx from '@hooks/useOnyx' ;
1313import usePolicy from '@hooks/usePolicy' ;
14+ import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
1415import useThemeStyles from '@hooks/useThemeStyles' ;
1516import { detachReceipt , navigateToStartStepIfScanFileCannotBeRead , removeMoneyRequestOdometerImage , replaceReceipt , setMoneyRequestReceipt } from '@libs/actions/IOU' ;
1617import { openReport } from '@libs/actions/Report' ;
@@ -28,7 +29,7 @@ import AttachmentModalContainer from '@pages/media/AttachmentModalScreen/Attachm
2829import type { AttachmentModalScreenProps } from '@pages/media/AttachmentModalScreen/types' ;
2930import CONST from '@src/CONST' ;
3031import ONYXKEYS from '@src/ONYXKEYS' ;
31- import ROUTES from '@src/ROUTES' ;
32+ import ROUTES , { type Route } from '@src/ROUTES' ;
3233import type SCREENS from '@src/SCREENS' ;
3334import type { ReceiptSource } from '@src/types/onyx/Transaction' ;
3435import type { FileObject } from '@src/types/utils/Attachment' ;
@@ -50,6 +51,7 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre
5051 const [ session ] = useOnyx ( ONYXKEYS . SESSION ) ;
5152 const [ introSelected ] = useOnyx ( ONYXKEYS . NVP_INTRO_SELECTED ) ;
5253 const policy = usePolicy ( report ?. policyID ) ;
54+ const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
5355
5456 // If we have a merge transaction, we need to use the receipt from the merge transaction
5557 const [ mergeTransaction ] = useOnyx ( `${ ONYXKEYS . COLLECTION . MERGE_TRANSACTION } ${ getNonEmptyStringOnyxID ( mergeTransactionID ) } ` ) ;
@@ -503,19 +505,23 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre
503505 < Button
504506 icon = { expensifyIcons . Camera }
505507 onPress = { ( ) => {
508+ const destinationRoute : Route = isOdometerImage
509+ ? ROUTES . ODOMETER_IMAGE . getRoute ( action ?? CONST . IOU . ACTION . CREATE , iouType , transactionID , reportID , imageType )
510+ : ROUTES . MONEY_REQUEST_STEP_SCAN . getRoute (
511+ action ?? CONST . IOU . ACTION . EDIT ,
512+ iouType ,
513+ draftTransactionID ?? transaction ?. transactionID ,
514+ report ?. reportID ,
515+ Navigation . getActiveRoute ( ) ,
516+ ) ;
517+
518+ if ( shouldUseNarrowLayout ) {
519+ Navigation . navigate ( destinationRoute , { forceReplace : true } ) ;
520+ return ;
521+ }
522+
506523 Navigation . dismissModal ( {
507- callback : ( ) =>
508- Navigation . navigate (
509- isOdometerImage
510- ? ROUTES . ODOMETER_IMAGE . getRoute ( action ?? CONST . IOU . ACTION . CREATE , iouType , transactionID , reportID , imageType )
511- : ROUTES . MONEY_REQUEST_STEP_SCAN . getRoute (
512- action ?? CONST . IOU . ACTION . EDIT ,
513- iouType ,
514- draftTransactionID ?? transaction ?. transactionID ,
515- report ?. reportID ,
516- Navigation . getActiveRoute ( ) ,
517- ) ,
518- ) ,
524+ callback : ( ) => Navigation . navigate ( destinationRoute ) ,
519525 } ) ;
520526 } }
521527 text = { translate ( 'common.replace' ) }
@@ -556,6 +562,7 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre
556562 draftTransactionID ,
557563 transaction ?. transactionID ,
558564 report ?. reportID ,
565+ shouldUseNarrowLayout ,
559566 ] ) ;
560567
561568 const customAttachmentContent = useMemo ( ( ) => {
0 commit comments