-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Sending a message scrolls down to previous message #54071
base: main
Are you sure you want to change the base?
Sending a message scrolls down to previous message #54071
Conversation
@hoangzinh 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] |
return; | ||
} | ||
reportScrollManager.scrollToBottom(); | ||
}); | ||
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID)); |
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.
Just a question, do we have any case that needs to run this navigation runAfterInteractions
?
// InteractionManager.runAfterInteractions(() => { | ||
// If a new comment is added and it's from the current user scroll to the bottom otherwise leave the user positioned where | ||
// they are now in the list. | ||
if (!isFromCurrentUser || scrollingVerticalOffset.current === 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.
I'm worrying whether if it causes any regression with this change scrollingVerticalOffset.current === 0
, can you explain why do you like to add this new condition here?
setPendingBottomScroll(false); | ||
}); | ||
} | ||
}, [pendingBottomScroll, prevSortedVisibleReportActionsObjects, reportScrollManager, isNewMessageDisplayed]); |
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.
should we change isNewMessageDisplayed
to use useMemo
, so we don't need to pass prevSortedVisibleReportActionsObjects
here?
@rinej can you elaborate why do we need to launch app in both mweb and app?
Can you explain this step too? Btw, @rinej we should use "Verify" to determine expected behavior, it's described here. If it's possible, can you outline by 1,2,3 numbers? For example
|
Explanation of Change
Problem:
Currently, when a user sends a message while positioned at the top of the chat, we scroll to the bottom, even if the newly sent message is not yet visible. This makes impression that we scroll to a previous message.
Solution:
In the PR we add behavior that the chat only scrolls to the bottom if the newly sent message is actually visible to the user.
Additional Consideration:
It's worth investigating the performance of message sending, particularly on Android, as there is noticeable lag during this operation. Addressing this could significantly improve the user experience.
Before Video:
OLD_behavior.mp4
After Video:
NEW_behavior.mp4
After merging newest main and conflicts resolution:
AndroidScroll.mp4
Fixed Issues
$ #53685
PROPOSAL: #53685 (comment)
Tests
Offline tests
QA Steps
Launch app in both mweb and app
Open a chat with long chat history
Scroll to the top of the page
Send a message
See that the new message is visible
Also make sure that normal message sending flow is not broken
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.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 and/or tagged@Expensify/design
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
AndroidScroll.mp4
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop