@@ -50,6 +50,7 @@ import type {FileObject} from '@src/types/utils/Attachment';
5050import captureReceipt from './captureReceipt' ;
5151import NavigationAwareCamera from './components/NavigationAwareCamera/Camera' ;
5252import ReceiptPreviews from './components/ReceiptPreviews' ;
53+ import getCameraAspectRatio from './getCameraAspectRatio' ;
5354import useMobileReceiptScan from './hooks/useMobileReceiptScan' ;
5455import useReceiptScan from './hooks/useReceiptScan' ;
5556import type IOURequestStepScanProps from './types' ;
@@ -112,8 +113,9 @@ function IOURequestStepScan({
112113 { photoResolution : { width : CONST . RECEIPT_CAMERA . PHOTO_WIDTH , height : CONST . RECEIPT_CAMERA . PHOTO_HEIGHT } } ,
113114 { videoResolution : { width : windowHeight , height : windowWidth } } ,
114115 ] ) ;
116+
115117 // Format dimensions are in landscape orientation, so height/width gives portrait aspect ratio
116- const cameraAspectRatio = format ? format . photoHeight / format . photoWidth : undefined ;
118+ const cameraAspectRatio = getCameraAspectRatio ( format , isInLandscapeMode ) ;
117119 const fps = useMemo ( ( ) => ( format ? Math . min ( Math . max ( 30 , format . minFps ) , format . maxFps ) : 30 ) , [ format ] ) ;
118120
119121 const navigateBack = ( ) => {
@@ -316,7 +318,7 @@ function IOURequestStepScan({
316318
317319 const path = getReceiptsUploadFolderPath ( ) ;
318320
319- captureReceipt ( camera . current , { flash, hasFlash, isPlatformMuted, path} )
321+ captureReceipt ( camera . current , { flash, hasFlash, isPlatformMuted, path, isInLandscapeMode } )
320322 . then ( ( photo : PhotoFile ) => {
321323 setDidCapturePhoto ( true ) ;
322324
@@ -435,7 +437,7 @@ function IOURequestStepScan({
435437 { cameraPermissionStatus === RESULTS . GRANTED && device != null && (
436438 < View style = { [ styles . cameraView , styles . alignItemsCenter ] } >
437439 < GestureDetector gesture = { tapGesture } >
438- < View style = { StyleUtils . getCameraViewfinderStyle ( cameraAspectRatio ) } >
440+ < View style = { StyleUtils . getCameraViewfinderStyle ( cameraAspectRatio , isInLandscapeMode ) } >
439441 < NavigationAwareCamera
440442 ref = { camera }
441443 device = { device }
0 commit comments