Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix receipt scan issues on mobile #32886

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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 All @@ -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({
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
Loading