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: Scan - No error pop-up and scan expense with corrupted PDF can be submitted via QAB #44778

Merged
merged 21 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ function IOURequestStepScan({
return;
}

// If we have a pdf file and if it is not validated then set the pdf file for validation and return
if (Str.isPDF(file.name ?? '') && !isPdfValidated) {
setPdfFile(file);
return;
Expand Down Expand Up @@ -466,7 +467,7 @@ function IOURequestStepScan({
>
{pdfFile && (
<PDFThumbnail
style={{height: 1, width: 1, opacity: 0, position: 'absolute'}}
style={styles.invisiblePdf}
previewSourceURL={pdfFile?.uri ?? ''}
onLoadSuccess={() => {
setPdfFile(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we call this with null here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason PDF isn't re-rendering on android native when file is changed to another file so we need to set it to null first.

Expand Down
4 changes: 3 additions & 1 deletion src/pages/iou/request/step/IOURequestStepScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ function IOURequestStepScan({
if (!isFileValid) {
return;
}

// If we have a pdf file and if it is not validated then set the pdf file for validation and return
if (Str.isPDF(file.name ?? '') && !isPdfValidated) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain the check for a not validated pdf here?

setPdfFile(file);
return;
Expand Down Expand Up @@ -517,7 +519,7 @@ function IOURequestStepScan({

const PDFThumbnailView = pdfFile ? (
<PDFThumbnail
style={{position: 'absolute', opacity: 0, width: 1, height: 1}}
style={styles.invisiblePdf}
previewSourceURL={pdfFile.uri ?? ''}
onLoadSuccess={() => {
setPdfFile(null);
Expand Down
7 changes: 7 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,13 @@ const styles = (theme: ThemeColors) =>
justifyContent: 'center',
},

invisiblePdf: {
position: 'absolute',
opacity: 0,
width: 1,
height: 1,
},

headerAnonymousFooter: {
color: theme.heading,
fontFamily: FontUtils.fontFamily.platform.EXP_NEW_KANSAS_MEDIUM,
Expand Down
Loading