[HOLD for payment 2021-12-06] [Pay on Tuesday 23rd Nov] Chat - Unable to scroll PDF file more than 2 pages in Preview page before sending
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
- Lunch the app
- Log in with any account
- Select any user
- Click on plus button
- Select Add Attachment
- Select Documents
- Select PDF with two and more pages, but don't send it
- Start scrolling the pages in Preview Page
Expected Result:
Able scroll PDF file more than 2 pages in Preview page before sending
Actual Result:
Unable scroll PDF file more than 2 pages in Preview page before sending
Workaround:
Unknown
Platform:
Where is this issue occurring?
- Android
Version Number: 1.0.99-0 Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos:
https://user-images.githubusercontent.com/43996225/133540977-6e19470e-9ccd-4939-a627-c64c87249144.mp4
Expensify/Expensify Issue URL: Issue reported by: Slack conversation:
:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
- Identify the pull request that introduced this issue and revert it.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
Triggered auto assignment to @Julesssss (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
Okay, I can reproduce this on Android. iOS Web and Desktop are fine. As the user is not blocked from sending PDFs and it only occurs on one platform I'm removing the deployBlocker label.
Viewing a previously shared attachment works fine, when sending an attachment you are able to scroll for about a second, and then it becomes slow and janky.
I can't see any recent change which would have introduced this. This PR from a month ago fixed PDF pan and zoom and may have been the cause.
It was originally fixed here by @rdjuric, so maybe you would like to look into this issue too, once I make it external?
Triggered auto assignment to @JmillsExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Issue reproducible during KI retests.
Whoops, I've been in the trenches of N6. Just posted to Upwork: https://www.upwork.com/jobs/~01b0af8ac91b6afc7b
Issue reproducible during KI retests.
Issue reproducible during KI retests.
Awaiting proposals
Issue reproducible during KI retests.
Still awaiting proposals
Issue reproducible during KI retests.
Issue reproducible during KI retests.
Still awaiting proposals
The problem lies inside a Modal component used in AttachmentModal. If attachment is PDF we pass CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE as Modal type, otherwise CONST.MODAL.MODAL_TYPE.CENTERED. This works correctly and passes 'centered_unswipeable' when we select PDF attachment. However, modal seems to ignore it, since scrolling is unavailable. If we just hardcode 'centered_unswipeable' as modal type, everything works as expected, scroll is available. I'm not sure what kind of magic is happening here, since in both cases we pass identical strings, but I wasn't able to track the root cause of this issue. However, if we store modalType in state and update it every time file changes, scrolling starts working.
Proposal:
- Add modalType key to state
this.state = {
isModalOpen: false,
isConfirmModalOpen: false,
file: null,
sourceURL: props.sourceURL,
modalType: CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE,
};
- Implement getModalType method inside AttachmentModal component
getModalType(sourceUrl, file) {
const modalType = (sourceUrl
&& (Str.isPDF(sourceUrl) || (file && Str.isPDF(file.name || this.props.translate('attachmentView.unknownFilename')))))
? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE
: CONST.MODAL.MODAL_TYPE.CENTERED;
return modalType;
}
- Update modal type inside displayFileInModal
displayFileInModal: ({file}) => {
if (!this.isValidSize(file)) {
this.setState({isConfirmModalOpen: true});
return;
}
if (file instanceof File) {
const source = URL.createObjectURL(file);
const modalType = this.getModalType(source, file);
this.setState({
isModalOpen: true,
sourceURL: source,
file,
modalType,
});
} else {
const modalType = this.getModalType(file.uri, file);
this.setState({
isModalOpen: true,
sourceURL: file.uri,
file,
modalType,
});
}
},
https://user-images.githubusercontent.com/9059945/139555069-035c3e50-cd00-41a7-9cf6-671ec37a89de.mp4
https://user-images.githubusercontent.com/9059945/139555124-a33f655c-e80f-40ed-9ac5-ef9b92a7c44f.mp4
Issue reproducible during KI retests.
@Julesssss can you review @eVoloshchak proposal above? https://github.com/Expensify/App/issues/5291#issuecomment-955576485
Created new job in Upwork, other had expired Doubled price to $500 https://www.upwork.com/jobs/~01ff20b40c42f9bf74
@Julesssss , please @eVoloshchak proposal above https://github.com/Expensify/App/issues/5291#issuecomment-955576485
We are placing all non-critical issues on hold while we're on a company offsite. The hold is expected to be lifted on 11/19 (but could go longer). For any PRs that are submitted before or during the hold, we will add a $250 bonus payment.