-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix: task background image getting cropped #36261
Conversation
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@@ -12,7 +12,7 @@ function AnimatedEmptyStateBackground() { | |||
const StyleUtils = useStyleUtils(); | |||
const {windowWidth, isSmallScreenWidth} = useWindowDimensions(); | |||
const illustrations = useThemeIllustrations(); | |||
const IMAGE_OFFSET_X = windowWidth / 2; | |||
const IMAGE_OFFSET_X = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that this doesn't cause regression - #35172
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I confirmed that this causes regression. x sensor doesn't work.
You should test with physical device. Test in android
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the horizontal sensor shift. Tested on physical device.
sensor.mp4
transform: [{translateX: withSpring(-IMAGE_OFFSET_X - xOffset.value)}, {translateY: withSpring(yOffset.value)}], | ||
// On Android, scroll view sub views gets clipped beyond container bounds. Set the top position so that image wouldn't get clipped | ||
top: IMAGE_OFFSET_Y, | ||
transform: [{translateX: withSpring(xOffset.value)}, {translateY: withSpring(yOffset.value)}, {scale: 1.15}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am worried about this change.
Please compare this branch vs staging on all platforms. There should be no 1px difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especially, test sensor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is video testing sensors on physical iOS device.
ios_out.mp4
There should be no 1px difference
I've added a top offset top: IMAGE_OFFSET_Y,
to prevent the image from getting clipped while tilting on Android devices. This actually pushes the image down by 40px. If you think we don't need to fix it (as this is the experience on prod at the moment), I'll leave it same as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the earlier implementation stretched out the image to 200% and then positioned the image back in view by translating the image by setting negative IMAGE_OFFSET_X
. This caused issues on web while resizing. Instead in current implementation, I'm keeping image width at 100%
but then scale it 15% to account for the additional span required while tilting the device.
Staging | This Branch |
---|---|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@staszekscp what do you think about this change? Since you recently worked on this file.
Also, we're trying to fix regression caused by your PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the regression was caused by this line, so I would look there for a fix. I've added it, because I wanted to move the background image a bit upwards following designers' suggestion.
I suppose that the cropped image problem can be rather related to wrong container size, not the animation itself. The animation moves the image outside of container boundaries, and as a result it gets cropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback.
@aswin-s let's not touch animation logic if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aimane-chnaif I don't see a way without modifying the animation logic. As we need to remove the '200%' width set for background image to fix the issue on web. In fact the core logic of the animation is still the same, all I have changed is using scale to position the image instead of setting 200% width and then positioning using negative margin.
We may also try generating adhoc build for this branch for extensive testing on native devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still look for solution without changing animation values
@aimane-chnaif Reason the image looks cropped is because of the Also note that the issue is not limited to Task page but all reports. Have a look at the attached video where I have explained this visually. Screen.Recording.2024-02-28.at.4_out.mp4I've tested the current version on multiple resolutions and devices and couldn't find any issues. |
@aswin-s please merge main. I will retest and see if any issues with that approach. |
@aimane-chnaif merged main |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid1.mp4android2.mp4Android: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
@deetergp can you please generate adhoc build? |
@aswin-s tested on this branch but still reproducible to me |
Can we also fix this? bug.mp4 |
@aimane-chnaif Fixed both issues. I've clamped translateY value so that the image vertical offset wouldn't go beyond the specified bounds. fix_out.mp4Typescript checks seems to be failing. But it is unrelated to current PR. |
@aswin-s please merge main. It's fixed now |
@aimane-chnaif Done! |
@@ -668,7 +668,7 @@ function ReportActionItem({ | |||
const isReversedTransaction = ReportActionsUtils.isReversedTransaction(parentReportAction); | |||
if (ReportActionsUtils.isDeletedParentAction(parentReportAction) || isReversedTransaction) { | |||
return ( | |||
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true), styles.justifyContentEnd]}> | |||
<View> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test case for this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test cases and test all affected pages where AnimatedEmptyStateBackground
is used:
- reversed/deleted transaction
- task view
- deleted task view
- money report view
- money request view
- normal chat
- thread
Tip: search for all usages of <AnimatedEmptyStateBackground
This PR cannot be simply approved without testing above on all platforms
@aswin-s bump ^ |
@aimane-chnaif Sorry for the hold up. I had to take time and retest all the scenarios on all the platforms.
|
@deetergp all yours |
@deetergp looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Details
This PR fixes an issue where the animated background image was getting clipped on a cancelled task report.
Fixed Issues
$ #33922
PROPOSAL: #33922 (comment)
Tests
Regular Chat report
Workspace Report
Money Report
Money Request
Thread View
Task Report
Verify that no errors appear in the JS console
Offline tests
QA Steps
Regular Chat report
Workspace Report
Money Report
Money Request
Thread View
Task Report
Verify that no errors appear in the JS console
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android_out.mp4
Android: mWeb Chrome
android-web_out.mp4
iOS: Native
ios_out.mp4
iOS: mWeb Safari
ios-web_out.mp4
MacOS: Chrome / Safari
web_out.mp4
MacOS: Desktop
desktop_out.mp4