Skip to content

Commit

Permalink
Merge pull request #32886 from mkhutornyi/fix-32865
Browse files Browse the repository at this point in the history
fix receipt scan issues on mobile

(cherry picked from commit fa504d7)
  • Loading branch information
luacmartins authored and OSBotify committed Dec 12, 2023
1 parent e1a8b80 commit 9043890
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/pages/iou/request/step/IOURequestStepScan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,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);
Expand All @@ -169,7 +174,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({
Expand Down
25 changes: 17 additions & 8 deletions src/pages/iou/request/step/IOURequestStepScan/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,18 @@ function IOURequestStepScan({
</View>
)}
{cameraPermissionStatus === RESULTS.GRANTED && device != null && (
<NavigationAwareCamera
ref={camera}
device={device}
style={[styles.cameraView]}
zoom={device.neutralZoom}
photo
cameraTabIndex={1}
/>
<View style={[styles.cameraView]}>
<View style={styles.flex1}>
<NavigationAwareCamera
ref={camera}
device={device}
style={[styles.flex1]}
zoom={device.neutralZoom}
photo
cameraTabIndex={1}
/>
</View>
</View>
)}
<View style={[styles.flexRow, styles.justifyContentAround, styles.alignItemsCenter, styles.pv3]}>
<AttachmentPicker shouldHideCameraOption>
Expand All @@ -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);
Expand Down

0 comments on commit 9043890

Please sign in to comment.