diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.js b/src/pages/iou/request/step/IOURequestStepScan/index.js index 5098401ddf79..e4c50ff25b5c 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); @@ -171,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({ diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.js b/src/pages/iou/request/step/IOURequestStepScan/index.native.js index 65a0ffd7bf59..e80fbbce0676 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.js +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.js @@ -214,14 +214,18 @@ function IOURequestStepScan({ )} {cameraPermissionStatus === RESULTS.GRANTED && device != null && ( - + + + + + )} @@ -239,6 +243,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);