Skip to content

Commit

Permalink
Merge pull request #38999 from margelo/perunt/auto-scroll
Browse files Browse the repository at this point in the history
Auto scroll fix
  • Loading branch information
yuwenmemon authored Mar 28, 2024
2 parents ef949e0 + 9d2fccc commit d704e04
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,13 @@ function ReportScreen({

// If a user has chosen to leave a thread, and then returns to it (e.g. with the back button), we need to call `openReport` again in order to allow the user to rejoin and to receive real-time updates
useEffect(() => {
if (!isFocused || prevIsFocused || !ReportUtils.isChatThread(report) || report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) {
if (!isSmallScreenWidth || !isFocused || prevIsFocused || !ReportUtils.isChatThread(report) || report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) {
return;
}
Report.openReport(report.reportID);

// We don't want to run this useEffect every time `report` is changed
// Excluding isSmallScreenWidth from the dependency list to prevent re-triggering on screen resize events.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [prevIsFocused, report.notificationPreference, isFocused]);

Expand Down

0 comments on commit d704e04

Please sign in to comment.