Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.3.80-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
Expensify/Expensify Issue URL:
Issue reported by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696951102341389
Action Performed:
- Open a chat with any user
- Click avatar to open RHN
- Resize browser to smaller and back original
Expected Result:
The background image is not partially cropped
Actual Result:
The background image is partially cropped
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- Android: Native
- Android: mWeb Chrome
- iOS: Native
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- MacOS: Desktop
Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2023-10-10.at.22.19.47.1.mov
Background.mp4
MacOS: Desktop
Screen.Recording.2023-10-10.at.22.18.59.mov
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~015433ddd90da9816b
- Upwork Job ID: 1711859135278239744
- Last Price Increase: 2023-10-10
Activity
[-]Background image crop after resize[/-][+][$500] Background image crop after resize[/+]melvin-bot commentedon Oct 10, 2023
Triggered auto assignment to @trjExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Oct 10, 2023
Job added to Upwork: https://www.upwork.com/jobs/~015433ddd90da9816b
melvin-bot commentedon Oct 10, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Oct 10, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (
External)m-natarajan commentedon Oct 10, 2023
Proposal by @namhihi237
Please re-state the problem that we are trying to solve in this issue.
The background image is not partially cropped after resizing the screen
What is the root cause of that problem?
When opening RHN and resizing the screen background image, the part that RHN occupies will be lost here
What changes do you think we should make in order to solve the problem?
we use a state variable forceRender to trigger a re-render of the component when the screen is focused.
When the screen is focused, we increment the forceRender variable, which causes the component to re-render with a different key.
This forces React to unmount and remount the component, effectively triggering a re-render of the AnimatedEmptyStateBackground component when the screen receives focus.
We update here
We add key
What alternative solutions did you explore? (Optional)
trjExpensify commentedon Oct 10, 2023
I can repro this:
fedirjh commentedon Oct 11, 2023
@namhihi237 Can you elaborate more on the root cause?
ashuvssut commentedon Oct 11, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The background image is partially cropped after resizing the screen at the point when
isSmallScreenWidthistrueWhat is the root cause of that problem?
useAnimatedStyledoesnt have a deps array. TheisSmallScreenWidthstate must be present in its deps array.App/src/pages/home/report/AnimatedEmptyStateBackground.js
Lines 20 to 35 in 1998fa3
What changes do you think we should make in order to solve the problem?
isSmallScreenWidthstate must be added to the deps array`.if (!isSmallScreenWidth) { - return {}; + return {transform: [{translateX: withSpring(0)}, {translateY: withSpring(0)}]}; }POC
I have fixed this issue. Please view the POC video
2023-10-11.06-58-35.mp4
Root cause demo using Devtools
before.mp4
after.mp4
dukenv0307 commentedon Oct 11, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The background image is partially cropped when resizing.
What is the root cause of that problem?
We don't need the animated style for case
isSmallScreenWidth=false(see here), but when resizing fromisSmallScreenWidth=truetoisSmallScreenWidth=false, the last transition state before the switch will still remain (as a behavior ofAnimated.Image), causing the issue.What changes do you think we should make in order to solve the problem?
We don't need animated style for
isSmallScreenWidth=falseas can be seen above, so we should use regularImagecomponent in that case, also to reduce overhead sinceAnimated.Imageadds a lot of overhead for animation manipulation so we should only use it when absolutely necessary.We can add here:
And replace this with
ImageComponent.What alternative solutions did you explore? (Optional)
We can update this line to
or
to force it to transform to 0, but I prefer the main suggested approach since it also optimizes performance.
fedirjh commentedon Oct 13, 2023
@trjExpensify This bug seems to be fixed by #26078 , not reproduced on staging.
melvin-bot commentedon Oct 16, 2023
@trjExpensify, @fedirjh Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
trjExpensify commentedon Oct 16, 2023
Ah yeah, same. I can't repro it anymore since that got deployed. We can close this issue out then! :)