App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-12-15] [$500] Extra long image shows white padding near top and bottom within chat list

Open isagoico opened this issue 5 years ago • 41 comments

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:

  1. Open chat
  2. Upload extra long image Please use Sample1 and Sample2 image
  3. 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

image image

Expensify/Expensify Issue URL:

Issue reported by: @PrashantMangukiya Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1631205658119900

View all open jobs on GitHub

isagoico avatar Sep 09 '21 16:09 isagoico

Triggered auto assignment to @tgolen (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Sep 09 '21 16:09 MelvinBot

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.

PrashantMangukiya avatar Sep 09 '21 17:09 PrashantMangukiya

Thanks for the proposal, I'll add this to external to get the ball rolling on this.

tgolen avatar Sep 09 '21 17:09 tgolen

Triggered auto assignment to @NicMendonca (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Sep 09 '21 17:09 MelvinBot

Upwork job: https://www.upwork.com/jobs/~01946439e5a02f9fd3

NicMendonca avatar Sep 13 '21 14:09 NicMendonca

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.

parasharrajat avatar Sep 13 '21 14:09 parasharrajat

Still on hold

NicMendonca avatar Sep 21 '21 20:09 NicMendonca

Still on hold

tgolen avatar Oct 01 '21 14:10 tgolen

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.

kadiealexander avatar Oct 08 '21 01:10 kadiealexander

@parasharrajat do you still think this won't be needed?

NicMendonca avatar Oct 12 '21 17:10 NicMendonca

This is off hold now. Where are we at with this @parasharrajat?

tgolen avatar Oct 19 '21 16:10 tgolen

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.

parasharrajat avatar Oct 19 '21 16:10 parasharrajat

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?

tgolen avatar Oct 19 '21 17:10 tgolen

Sorry No! we are not discussing that modal in this issue. Based on the screenshot image

This is the chat list attachment View.

parasharrajat avatar Oct 19 '21 17:10 parasharrajat

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?

tgolen avatar Oct 19 '21 20:10 tgolen

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? ☝️

NicMendonca avatar Oct 26 '21 13:10 NicMendonca

Created new Upwork job, other had auto-closed https://www.upwork.com/jobs/~01c973ddeff1487694 Doubled price to $500

mallenexpensify avatar Nov 02 '21 19:11 mallenexpensify

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.

parasharrajat avatar Nov 03 '21 02:11 parasharrajat

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.

image

aswin-s avatar Nov 03 '21 05:11 aswin-s

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

NicMendonca avatar Nov 03 '21 20:11 NicMendonca