diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 6924725eb99b6..5c140589e4f3c 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -177,6 +177,8 @@ function ReportActionsList({ const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID}); const participantsContext = useContext(PersonalDetailsContext); + const [isScrollToBottomEnabled, setIsScrollToBottomEnabled] = useState(false); + useEffect(() => { const unsubscriber = Visibility.onVisibilityChange(() => { setIsVisible(Visibility.isVisible()); @@ -458,10 +460,11 @@ function ReportActionsList({ Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID)); return; } - reportScrollManager.scrollToBottom(); + + setIsScrollToBottomEnabled(true); }); }, - [reportScrollManager, report.reportID], + [report.reportID], ); useEffect(() => { // Why are we doing this, when in the cleanup of the useEffect we are already calling the unsubscribe function? @@ -667,8 +670,12 @@ function ReportActionsList({ const onLayoutInner = useCallback( (event: LayoutChangeEvent) => { onLayout(event); + if (isScrollToBottomEnabled) { + reportScrollManager.scrollToBottom(); + setIsScrollToBottomEnabled(false); + } }, - [onLayout], + [isScrollToBottomEnabled, onLayout, reportScrollManager], ); const onContentSizeChangeInner = useCallback( (w: number, h: number) => {