-
Notifications
You must be signed in to change notification settings - Fork 3k
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 2023-05-22] [$1000] Loading spinner is cut off on long images when reopening the chat #18040
Comments
Triggered auto assignment to @NicMendonca ( |
Bug0 Triage Checklist (Main S/O)
|
Let's first discuss in Slack |
ProposalPlease re-state the problem that we are trying to solve in this issue.Loading spinner is cut off on long images when reopening the chat What is the root cause of that problem?The problem arises due to the aspect ratio of long images, which is causing the thumbnailScreenWidth to become narrower than the width of the spinner. What changes do you think we should make in order to solve the problem?Solution AWe can cap the max-height and limit the min-width of the thumbnail by updating this function App/src/components/ThumbnailImage.js Lines 55 to 76 in f8acfae
Which is responsible to calculate Thumbnail ImageSize ,thumbnailScreenWidth and thumbnailScreenHeight to this calculateThumbnailImageSize(width, height) {
if (!width || !height) {
return {};
}
// Width of the thumbnail works better as a constant than it does
// a percentage of the screen width since it is relative to each screen
// Note: Clamp minimum width 40px to support touch device
let thumbnailScreenWidth = lodashClamp(width, 40, 250);
// alert(thumbnailScreenWidth);
let imageHeight = height / (width / thumbnailScreenWidth);
let thumbnailScreenHeight = lodashClamp(imageHeight, 40, this.props.windowHeight * 0.40);
let aspectRatio = height / width;
// If thumbnail height is greater than its width, then the image is portrait otherwise landscape.
// For portrait images, we need to adjust the width of the image to keep the aspect ratio and vice-versa.
if (thumbnailScreenHeight > thumbnailScreenWidth) {
//Checking if the aspect ratio of image does not cause the value of thumbnailScreenWidth to fall below the minimum width.
if(Math.round(thumbnailScreenHeight * (1 / aspectRatio))<80){
thumbnailScreenWidth = 80;
thumbnailScreenHeight = 80*aspectRatio;
// Capping the maximum height of the thumbnail
if (thumbnailScreenHeight>500){
thumbnailScreenHeight = 500;
}
}
else{
thumbnailScreenWidth = Math.round(thumbnailScreenHeight * (1 / aspectRatio));
}
} else {
thumbnailScreenHeight = Math.round(thumbnailScreenWidth * aspectRatio);
}
return {thumbnailWidth: thumbnailScreenWidth, thumbnailHeight: Math.max(40, thumbnailScreenHeight)};
} and then we can change resize mode from contain to cover here
resizeMode={Image.resizeMode.cover} Solution BWe can cap the max height here App/src/components/ThumbnailImage.js Line 90 in 6f6cf65
by adding a new style maxHeight like this
and since the aspect ratio of long images causes the width of the thumbnail to fall below the width of spinner, we can simply check if thumbnailScreenWidth is less than the desired min with (or width of spinner) and if so we can change it in the function and then to make the image fill the entire area of the thumbnail and be centered, we can simply set image resize mode to cover. To do this we can change this line
to this
ResultBoth solutions will give us same result I think we should also check and set cap on min-height and Max width of the thumbnail when it is in landscape mode |
Job added to Upwork: https://www.upwork.com/jobs/~0105084e7856349f53 |
Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
Triggered auto assignment to @Beamanator ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Loading spinner is cut off on long images when reopening the chat What is the root cause of that problem?The image does not maintain a What changes do you think we should make in order to solve the problem?Solution A
Solution B
- let thumbnailScreenWidth = lodashClamp(width, 40, 250);
- const imageHeight = height / (width / thumbnailScreenWidth);
- let thumbnailScreenHeight = lodashClamp(imageHeight, 40, this.props.windowHeight * 0.40);
- const aspectRatio = height / width;
-
- // If thumbnail height is greater than its width, then the image is portrait otherwise landscape.
- // For portrait images, we need to adjust the width of the image to keep the aspect ratio and vice-versa.
- if (thumbnailScreenHeight > thumbnailScreenWidth) {
- thumbnailScreenWidth = Math.round(thumbnailScreenHeight * (1 / aspectRatio));
- } else {
- thumbnailScreenHeight = Math.round(thumbnailScreenWidth * aspectRatio);
- }
- return {thumbnailWidth: thumbnailScreenWidth, thumbnailHeight: Math.max(40, thumbnailScreenHeight)};
+ let zoomScale = Math.min(250 / width, this.props.windowHeight * 0.4 / height)
+ let thumbnailWidth = Math.max(40, width * zoomScale)
+ let thumbnailHeight = Math.max(40, height * zoomScale)
+ return {thumbnailWidth, thumbnailHeight)};
|
ProposalUpdated proposal based on slack conversation |
ProposalPlease re-state the problem that we are trying to solve in this issue.The loading spinner is cut off on long images when reopening the chat What is the root cause of that problem?We are expecting all image content to be shown in the thumbnail while also being required to keep the aspect ratio.
This expectation will make the thumbnail image too narrow when the height is too long. What changes do you think we should make in order to solve the problem?According to the slack discussion. We are ok to hide some image content and show the middle part of the image if the dimension is extremely long. I'd propose removing this code part, since we are not required to keep the aspect ratio for our thumbnail: App/src/components/ThumbnailImage.js Lines 66 to 74 in a786349
And also extract Before: App/src/components/ThumbnailImage.js Lines 98 to 102 in a786349
After:
What alternative solutions did you explore? (Optional)N/A Result |
@parasharrajat since you are the author of the code part I mentioned. With the change to the expected behavior, do you think my proposal approach is correct? or it will cause regression? Here is how the thumbnail will look like using a sample image from your previously fixed issue. |
Not overdue, proposals yet to be reviewed 👍 |
ProposalPlease re-state the problem that we are trying to solve in this issue.Loading spinner is cut off on long images when reopening the chat. What is the root cause of that problem?When images are to slim after resizing them to fit in the What changes do you think we should make in order to solve the problem?As per the Slack bug thread feedback, I'm proposing a new solution where we use a
I propose to replace the
As part of the proposal, two new
What alternative solutions did you explore? (Optional)I explored working with the resize of the image within Result( Screen.Recording.2023-05-01.at.10.25.53.AM.mov |
📣 @davidcruzcs! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Format:
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
Thanks for proposal everyone. Solution A from @hellohublot's proposal looks good to me. I do not think maxHeight will be required. But if required we can clamp 🎀👀🎀 C+ reviewed cc: @Beamanator |
@Beamanator @hellohublot @NicMendonca @sobitneupane this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Not overdue: #18485 (comment) |
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.13-5 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 2023-05-22. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@Harshdeepjoshi @sobitneupane @hellohublot please apply to the job so we can issue payment: https://www.upwork.com/jobs/~0105084e7856349f53 |
Going OOO until June 5th so assigning a buddy to this GH to issue payment once everyone has applied ^^ |
Triggered auto assignment to @slafortune ( |
This comment was marked as duplicate.
This comment was marked as duplicate.
https://expensify.slack.com/archives/C049HHMV9SM/p1684922451095849 |
Regression Test Proposal
Do we agree 👍 or 👎 |
@Harshdeepjoshi @sobitneupane @hellohublot - offers sent 👍 |
@Beamanator, @slafortune, @hellohublot, @sobitneupane Huh... This is 4 days overdue. Who can take care of this? |
@Harshdeepjoshi looks like two offers got sent and accepted - I paid one and close the other 👍 |
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:
Expected Result:
The loading spinner should be fully visible and centered on the screen while the long image is still loading after reopening the chat window. The thumbnail should be capped at a maximum height and minimum width so that the loading spinner is displayed properly.
Actual Result:
The loading spinner is cut off on both the left and right sides, with only a small portion of the spinner visible.
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.5.4
Reproducible in staging?: Needs reproduction
Reproducible in production?: Needs reproduction
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
2023-04-25.21-56-41.online-video-cutter.com.mp4
Expensify/Expensify Issue URL:
Issue reported by: @Harshdeepjoshi
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1682442117599109
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: