You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-05-22] [$1000] Loading spinner is cut off on long images when reopening the chat #18040
Reopened the chat window containing the sent long image.
Observed the loading spinner that appears while the image is still loading.
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?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
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
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 deviceletthumbnailScreenWidth=lodashClamp(width,40,250);// alert(thumbnailScreenWidth);letimageHeight=height/(width/thumbnailScreenWidth);letthumbnailScreenHeight=lodashClamp(imageHeight,40,this.props.windowHeight*0.40);letaspectRatio=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
<View style={[this.props.style, styles.overflowHidden , {maxHeight:400}]}> //we can add a new style in stylesheet for 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 calculateThumbnailImageSize to our desired min with
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
changed the title [-] Loading spinner is cut off on long images when reopening the chat[/-][+][$1000] Loading spinner is cut off on long images when reopening the chat[/+]on Apr 28, 2023
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:
[@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
[@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
Activity
MelvinBot commentedon Apr 26, 2023
Triggered auto assignment to @NicMendonca (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.MelvinBot commentedon Apr 26, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)shawnborton commentedon Apr 27, 2023
Let's first discuss in Slack
Harshdeepjoshi commentedon Apr 27, 2023
Proposal
Please 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 A
We 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
and then we can change resize mode from contain to cover here
App/src/components/ImageWithSizeCalculation.js
Line 85 in 4fefc48
Solution B
We can cap the max height here
App/src/components/ThumbnailImage.js
Line 90 in 6f6cf65
by adding a new style
maxHeightlike thisand 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
calculateThumbnailImageSize to our desired min with
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
App/src/components/ImageWithSizeCalculation.js
Line 85 in 6f6cf65
to this
Result
Both 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
[-] Loading spinner is cut off on long images when reopening the chat[/-][+][$1000] Loading spinner is cut off on long images when reopening the chat[/+]MelvinBot commentedon Apr 28, 2023
Job added to Upwork: https://www.upwork.com/jobs/~0105084e7856349f53
MelvinBot commentedon Apr 28, 2023
Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new.
MelvinBot commentedon Apr 28, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)38 remaining items
NicMendonca commentedon May 23, 2023
Going OOO until June 5th so assigning a buddy to this GH to issue payment once everyone has applied ^^
melvin-bot commentedon May 23, 2023
Triggered auto assignment to @slafortune (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon May 23, 2023
sobitneupane commentedon May 24, 2023
#8238
#8238 (comment)
https://expensify.slack.com/archives/C049HHMV9SM/p1684922451095849
sobitneupane commentedon May 24, 2023
Regression Test Proposal
Do we agree 👍 or 👎
slafortune commentedon May 24, 2023
@Harshdeepjoshi @sobitneupane @hellohublot - offers sent 👍
melvin-bot commentedon May 29, 2023
@Beamanator, @slafortune, @hellohublot, @sobitneupane Huh... This is 4 days overdue. Who can take care of this?
slafortune commentedon May 30, 2023
@Harshdeepjoshi looks like two offers got sent and accepted - I paid one and close the other 👍