[HOLD for payment 2021-12-15] [$500] Extra long image shows white padding near top and bottom within chat list
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:
- Open chat
- Upload extra long image Please use Sample1 and Sample2 image
- Once image uploaded, you can see thumbnail shows padding at top bottom border.
Expected Result:
Image should fill the preview thumbnail.
Actual Result:
There's padding on the top and bottom of the image preview.
Workaround:
N/A Visual issue.
Platform:
Where is this issue occurring?
- Web
- iOS
- Android
- Desktop App
- Mobile Web
Version Number: 1.0.95-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:
Issue reported by: @PrashantMangukiya Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1631205658119900
Triggered auto assignment to @tgolen (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
Proposed Solution:
I will suggest to update line 79 within src/components/ImageWithSizeCalculation.js
Current code: https://github.com/Expensify/App/blob/bc035f5d918c5da8750ec9cd5bc224db348b2667/src/components/ImageWithSizeCalculation.js#L70-L82
Solution - Change line 79 to cover
render() {
return (
<Image
style={[
styles.w100,
styles.h100,
this.props.style,
]}
source={{uri: this.props.url}}
resizeMode="cover" // Change contain to cover
/>
);
}
This solve the problem, I already tested it. But I am wandering that it will have side affect to other component, other platform etc. So I will do more research and came to final decision thereafter.
Thanks.
Thanks for the proposal, I'll add this to external to get the ball rolling on this.
Triggered auto assignment to @NicMendonca (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Upwork job: https://www.upwork.com/jobs/~01946439e5a02f9fd3
I don't think this is going to be needed if we are planning to add thumbnails for the attachment preview. I can't find the issue but earlier there was a discussion to use the image thumbnails.
Still on hold
Still on hold
Please refer to this post for updated information on the n6 hold, we've raised the bonus to $250 for all issues where a PR is created before the N6 hold is lifted.
@parasharrajat do you still think this won't be needed?
This is off hold now. Where are we at with this @parasharrajat?
Sorry, missed the earlier ping, Nicole.
My catch on this issue is that we won't need this at all. There are multiple issues with Images atm. The main issue is they trigger layout shifts.
My suggestion is to use image thumbnails or fixed-size images for the chat list as we allow users to enlarge the image on click.
I think, even if we used thumbnails in the chat list, this issue would still be around, wouldn't it? Since they would click on the thumbnail to enlarge the image and that would bring them to the modal being discussed here?
Sorry No! we are not discussing that modal in this issue.
Based on the screenshot

This is the chat list attachment View.
Oh, you're right. Sorry, I got this mixed up with another issue for the modal. I agree that thumbnails or fixed-size would be a better fix. Should we close this issue and open up one for a proper change?
My suggestion is to use image thumbnails or fixed-size images for the chat list as we allow users to enlarge the image on click.
@parasharrajat @isagoico should we be opening a new GH, based off this? ☝️
Created new Upwork job, other had auto-closed https://www.upwork.com/jobs/~01c973ddeff1487694 Doubled price to $500
Sorry, @NicMendonca just forgot to reply to your comments. I think we can keep the same issue and if my suggestion looks good then we can proceed.
I just need n x b size for thumbnails.
The root cause of the issue is incorrect image size calculation. The ThumbnailImage component computes scaled width and height for the remoteURL using the inbuiltgetSize method. This doesn't take into consideration the style applied for image elements, which has a 1px border around it.
<ThumbnailImage
previewSourceURL={previewSource}
style={webViewStyles.tagStyles.img}
isAuthTokenRequired={isAttachment}
/>
So the rendered image will have its resultant width reduced by 2px when it gets rendered onto screen (Box sizing duh!). This is applicable for all images just that the 2px difference make a huge impact for extra long images.
Example for Sample 1 - Native width & height: 875x14894 Scaled thumbnail size: 60x1024 Ideal width & height after adjusting for border: 58 x 987 😱
So my proposal is to not pass the default image style down to the ImageWithSizeCalculation component and just apply any styles to the parent View inside ThumbnailImage.js.
https://github.com/Expensify/App/blob/a53bbaa43e461b9e04365f6fb6d38e4f3913ad08/src/components/ThumbnailImage.js#L52-L69
This way the ImageWithSizeCalculation calculation doesn't need to know about any styles applied to the rendered image and the logic will be reusable across the app.

Not overdue, job price was doubled yesterday: https://www.upwork.com/jobs/~01c973ddeff1487694