-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2022-04-27] [$500] Pdf preview is not in centered - reported by @thesahindia #8127
Comments
Triggered auto assignment to @kevinksullivan ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel ( |
Triggered auto assignment to @luacmartins ( |
@thesahindia please apply when you get a chance! |
Price doubled. |
ProposalCauseView doesn't center its children. Simple because it has no proper styling. Solution
onPageLoadSuccess = (index) => {
if (index + 1 === this.state.numPages) {
const canvasElements = document.getElementsByClassName('react-pdf__Page__canvas');
let totalHeight = 0;
// I edit this because getting error when using forEach
//canvasElements.forEach((ce) => {
// totalHeight += parseInt(ce.style.height, 10);
// });
for (let counter = 0; counter < canvasElements.length; counter++) {
totalHeight += parseInt(canvasElements[counter].style.height, 10);
}
this.setState({canvasHeight: totalHeight});
}
}
onLayout = (event) => {
if (!(
this.state.windowWidth !== event.nativeEvent.layout.width
&& this.state.windowHeight !== event.nativeEvent.layout.height
)) {
return;
}
this.setState({windowWidth: event.nativeEvent.layout.width, windowHeight: event.nativeEvent.layout.height});
}
const smallCanvasStyle = (this.state.windowHeight > this.state.canvasHeight) ? {
//marginTop: ((this.state.windowHeight - this.state.canvasHeight) / 2) - 10,
//marginBottom: ((this.state.windowHeight - this.state.canvasHeight) / 2) - 10,
alignItems: 'center',
} : {};
<View
style={[styles.PDFView, this.props.style, smallCanvasStyle]}
onLayout={this.onLayout}
> 20220328_013327.mp4 |
@metehanozyurt It seems like the gray background was modified in your solution. According to the original posting, only the preview content should be affected. I think the solution here is as simple as adding |
Thanks, @luacmartins. I'll review this again tomorrow. @metehanozyurt Please add an updated proposal address this one #8127 (comment) |
Thanks, @Santhosh-Sellavel. Thank you for correcting me @luacmartins. My solution regarding marginTop and marginBottom is not as good as @luacmartins' which is more accurate for smaller PDF sizes. However if Lines 1682 to 1691 in 9c50db7
It works flawlessly for PDFs with smaller sizes but if 20220328_231652.mp4So, if my proposal is edited as below, it seems to be working well. const smallCanvasStyle = (this.state.windowHeight > this.state.canvasHeight) ? {
marginTop: ((this.state.windowHeight - this.state.canvasHeight) / 2) - 10,
marginBottom: ((this.state.windowHeight - this.state.canvasHeight) / 2) - 10,
} : {}; TO const smallCanvasStyle = (this.state.windowHeight > this.state.canvasHeight) ? {
alignItems: 'center',
} : {}; After @luacmartins' suggestion, it looks like as the following: 20220328_231812.mp4 |
Proposal in review |
Reviewing this 👀 |
@metehanozyurt is this your updated proposal? |
For smaller pdf, it works well but for bigger pdf, the start of the pdf is not displayed. Screen.Recording.2022-03-30.at.11.37.24.PM.movcc: @luacmartins |
I wonder if there's a css only solution for this, since that would be much simpler than playing around with the screen/item sizes. |
Yep would be nice & clean! |
Thanks for response @Santhosh-Sellavel. You are absolutely right @luacmartins. If I find it, I will definitely write it down. Did you edit this file @Santhosh-Sellavel ? Lines 1682 to 1691 in 9c50db7
because if you add If yes, can you please delete that line and try again? According to my proposal it should work like the video below. Thanks. 20220328_231812.mp4 |
No, I didn’t @metehanozyurt |
Thanks @metehanozyurt! I think it's worth exploring a css only solution before we introduce more complex logic. Let me know if you come up with anything. |
Thank you @luacmartins and @Santhosh-Sellavel. I think i found the css change we need. Can you please check my solution. Only We need to change like this. Thank you so much for your kind words and encouragements 🙏 . PDFView: {
display: 'grid',
backgroundColor: themeColors.modalBackground,
width: '100%',
height: '100%',
justifyContent: 'center',
overflow: 'hidden',
overflowY: 'auto',
alignItems: 'center',
}, 20220401_000954.mp4 |
@metehanozyurt Nice one! I tested in all platforms and that seemed to fix the issue in all of them! I thought that |
@luacmartins Solution seems to be working! But wondering why @metehanozyurt how does |
Thank you @luacmartins and @Santhosh-Sellavel. My first approach was as follows. I want to implement "justify-content" in small pdf sizes. but I don't need this setting for large pdf sizes. According to the this URL grid offers me this opportunity. Maybe this URL can be answer about addresses the issue. Like you, I have doubts that it is the only solution. |
@luacmartins With a couple of suggestions.
|
Agreed! Your solution looks good @metehanozyurt! As for @Santhosh-Sellavel suggestions, I would not add |
📣 @metehanozyurt You have been assigned to this job by @luacmartins! |
@metehanozyurt apply to the job when you get a chance. Thanks! |
Nice catch @luacmartins , yes adding there could create some unnescessary confusion. But the reason behind the suggestion is to use cc: @metehanozyurt |
PR was merged. Not overdue. |
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.55-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2022-04-27. 🎊 |
@Santhosh-Sellavel and @thesahindia paid. @metehanozyurt can you accept the offer so i can finish payment for you? Thanks! |
All set, thanks! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Preview should be in center.
Actual Result:
Preview is not in centered
Workaround:
unknown
Platform:
Where is this issue occurring?
Version Number: 1.1.42-3
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Screenshot 2022-03-02 at 12.16.41 AM.pdf
Issue reported by: @thesahindia
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1646160975698469
Job Post: https://www.upwork.com/jobs/~0154111729e0a5dbd4
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: