From 215578bec79bca36898e9095b8aa167139348b02 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 16 Oct 2025 09:26:04 +0700 Subject: [PATCH] Expense-After split expense preview displayed, in few seconds a confirm details page open --- .../request/step/IOURequestStepScan/index.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 0bcfd33ba8f6..46c959adcd5f 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -140,6 +140,9 @@ function IOURequestStepScan({ selector: transactionDraftValuesSelector, canBeMissing: true, }); + + const shouldPreventPhotoCapture = useRef(false); + const transactions = useMemo(() => { const allTransactions = optimisticTransactions && optimisticTransactions.length > 1 ? optimisticTransactions : [initialTransaction]; return allTransactions.filter((transaction): transaction is Transaction => !!transaction); @@ -789,7 +792,20 @@ function IOURequestStepScan({ }); }, []); + useEffect(() => { + if (!isTabActive) { + return; + } + shouldPreventPhotoCapture.current = false; + }, [isTabActive]); + const capturePhoto = useCallback(() => { + if (shouldPreventPhotoCapture.current) { + return; + } + if (!isMultiScanEnabled) { + shouldPreventPhotoCapture.current = true; + } if (trackRef.current && isFlashLightOn) { trackRef.current .applyConstraints({ @@ -805,7 +821,7 @@ function IOURequestStepScan({ } getScreenshot(); - }, [isFlashLightOn, getScreenshot, clearTorchConstraints]); + }, [isFlashLightOn, getScreenshot, clearTorchConstraints, isMultiScanEnabled]); const panResponder = useRef( PanResponder.create({