Skip to content

Commit

Permalink
Merge pull request #52955 from Anaslancer/Page-do-scroll-to-bottom-wh…
Browse files Browse the repository at this point in the history
…en-send-message-in-public-room

Page do scroll to bottom when send message in public room
  • Loading branch information
aldo-expensify authored Dec 16, 2024
2 parents 314e4fb + 4628a5b commit 7d5bf75
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,19 +415,21 @@ function ReportActionsList({

const scrollToBottomForCurrentUserAction = useCallback(
(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) {
return;
}
if (!hasNewestReportActionRef.current) {
if (isInNarrowPaneModal) {
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) {
return;
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
return;
}
InteractionManager.runAfterInteractions(() => reportScrollManager.scrollToBottom());
if (!hasNewestReportActionRef.current) {
if (isInNarrowPaneModal) {
return;
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
return;
}
reportScrollManager.scrollToBottom();
});
},
[isInNarrowPaneModal, reportScrollManager, report.reportID],
);
Expand Down

0 comments on commit 7d5bf75

Please sign in to comment.