From f4456b3bf79f5952fcbcf8a4742802592442a526 Mon Sep 17 00:00:00 2001 From: mkhutornyi Date: Tue, 12 Dec 2023 01:39:10 +0100 Subject: [PATCH 1/2] fix receipt scan issues on mobile --- .../request/step/IOURequestStepScan/index.js | 5 ++++ .../step/IOURequestStepScan/index.native.js | 25 +++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.js b/src/pages/iou/request/step/IOURequestStepScan/index.js index 5098401ddf79..4544aaa00e73 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.js +++ b/src/pages/iou/request/step/IOURequestStepScan/index.js @@ -154,6 +154,11 @@ function IOURequestStepScan({ const fileSource = URL.createObjectURL(imageFile); IOU.setMoneyRequestReceipt_temporaryForRefactor(transactionID, fileSource, imageFile.name); + if (backTo) { + Navigation.goBack(backTo); + return; + } + // When an existing transaction is being edited (eg. not the create transaction flow) if (transactionID !== CONST.IOU.OPTIMISTIC_TRANSACTION_ID) { IOU.replaceReceipt(transactionID, imageFile, fileSource); diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.js b/src/pages/iou/request/step/IOURequestStepScan/index.native.js index 6751ec032306..1c95475d6c49 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.js +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.js @@ -204,14 +204,18 @@ function IOURequestStepScan({ )} {cameraPermissionStatus === RESULTS.GRANTED && device != null && ( - + + + + + )} @@ -229,6 +233,11 @@ function IOURequestStepScan({ const filePath = file.uri; IOU.setMoneyRequestReceipt_temporaryForRefactor(transactionID, filePath, file.name); + if (backTo) { + Navigation.goBack(backTo); + return; + } + // When a transaction is being edited (eg. not in the creation flow) if (transactionID !== CONST.IOU.OPTIMISTIC_TRANSACTION_ID) { IOU.replaceReceipt(transactionID, file, filePath); From 53f2895f7debd318daf884928a1257a2ee5c1814 Mon Sep 17 00:00:00 2001 From: mkhutornyi Date: Tue, 12 Dec 2023 01:45:19 +0100 Subject: [PATCH 2/2] fix lint --- src/pages/iou/request/step/IOURequestStepScan/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.js b/src/pages/iou/request/step/IOURequestStepScan/index.js index 4544aaa00e73..e4c50ff25b5c 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.js +++ b/src/pages/iou/request/step/IOURequestStepScan/index.js @@ -176,7 +176,7 @@ function IOURequestStepScan({ } Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(iouType, transactionID, reportID)); - }, [cameraRef, report, iouType, transactionID, reportID]); + }, [cameraRef, report, iouType, transactionID, reportID, backTo]); const panResponder = useRef( PanResponder.create({