Skip to content

Commit

Permalink
fix receipt scan issues on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhutornyi committed Dec 12, 2023
1 parent 86a2521 commit f4456b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/pages/iou/request/step/IOURequestStepScan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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 @@ -204,14 +204,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 @@ -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);
Expand Down

0 comments on commit f4456b3

Please sign in to comment.