From 5fb31e9bce84ce99feddaa0f4ff277c1d79e2893 Mon Sep 17 00:00:00 2001 From: "Shridhar Goel (via MelvinBot)" Date: Sun, 10 May 2026 04:20:08 +0000 Subject: [PATCH] Add videoResolution constraint and fps prop to AttachmentCamera The AttachmentCamera component was missing the videoResolution constraint in useCameraFormat, causing VisionCamera to select a 5712x4284 (24.5MP) format that overwhelms the iOS preview pipeline (blurry viewfinder) and doubles capture time (apparent capture failure). Adds the same videoResolution and fps configuration that the working receipt scanner already uses. Co-authored-by: Shridhar Goel --- src/components/AttachmentPicker/AttachmentCamera.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/AttachmentPicker/AttachmentCamera.tsx b/src/components/AttachmentPicker/AttachmentCamera.tsx index 4ecbf78bfdc3..10c7a6d706d6 100644 --- a/src/components/AttachmentPicker/AttachmentCamera.tsx +++ b/src/components/AttachmentPicker/AttachmentCamera.tsx @@ -18,6 +18,7 @@ import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import useWindowDimensions from '@hooks/useWindowDimensions'; import {showCameraPermissionsAlert} from '@libs/fileDownload/FileUtils'; import getPhotoSource from '@libs/fileDownload/getPhotoSource'; import getReceiptsUploadFolderPath from '@libs/getReceiptsUploadFolderPath'; @@ -51,6 +52,7 @@ function AttachmentCamera({isVisible, onCapture, onClose}: AttachmentCameraProps const {translate} = useLocalize(); const insets = useSafeAreaInsets(); const StyleUtils = useStyleUtils(); + const {windowWidth, windowHeight} = useWindowDimensions(); const lazyIcons = useMemoizedLazyExpensifyIcons(['Bolt', 'boltSlash', 'CameraFlip', 'Close']); const lazyIllustrations = useMemoizedLazyIllustrations(['Shutter', 'Hand']); @@ -68,7 +70,9 @@ function AttachmentCamera({isVisible, onCapture, onClose}: AttachmentCameraProps const format = useCameraFormat(device, [ {photoAspectRatio: CONST.RECEIPT_CAMERA.PHOTO_ASPECT_RATIO}, {photoResolution: {width: CONST.RECEIPT_CAMERA.PHOTO_WIDTH, height: CONST.RECEIPT_CAMERA.PHOTO_HEIGHT}}, + {videoResolution: {width: windowHeight, height: windowWidth}}, ]); + const fps = format ? Math.min(Math.max(30, format.minFps), format.maxFps) : 30; const hasFlash = !!device?.hasFlash; // Format dimensions are in landscape orientation, so height/width gives portrait aspect ratio const cameraAspectRatio = useMemo(() => (format ? format.photoHeight / format.photoWidth : undefined), [format]); @@ -241,6 +245,7 @@ function AttachmentCamera({isVisible, onCapture, onClose}: AttachmentCameraProps ref={cameraRef} device={device} format={format ?? undefined} + fps={fps} style={styles.flex1} zoom={device.neutralZoom} photo