Skip to content

Commit

Permalink
Merge pull request #46724 from bernhardoj/fix/46290-report-doesnt-scr…
Browse files Browse the repository at this point in the history
…oll-to-bottom-when-sending-msg

Fix chat doesn't scroll to bottom when adding message while linked to an old action
  • Loading branch information
MonilBhavsar authored Aug 16, 2024
2 parents 5d09846 + 1c2de3e commit 9940e99
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,16 @@ function ReportActionsList({
(isFromCurrentUser: boolean) => {
// 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 || !hasNewestReportActionRef.current) {
if (!isFromCurrentUser) {
return;
}
if (!hasNewestReportActionRef.current) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
return;
}
InteractionManager.runAfterInteractions(() => reportScrollManager.scrollToBottom());
},
[reportScrollManager],
[reportScrollManager, report.reportID],
);
useEffect(() => {
// Why are we doing this, when in the cleanup of the useEffect we are already calling the unsubscribe function?
Expand Down

0 comments on commit 9940e99

Please sign in to comment.