From e1b48e8c9351d5c25fc6e12b136d3ae499ed6183 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Fri, 20 Feb 2026 20:36:48 +0430 Subject: [PATCH] fix(expenses): prevent bottom comments from flashing when switching chats --- src/pages/inbox/report/ReportActionsList.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pages/inbox/report/ReportActionsList.tsx b/src/pages/inbox/report/ReportActionsList.tsx index f0716d8d37dc8..e7bb5fba20264 100644 --- a/src/pages/inbox/report/ReportActionsList.tsx +++ b/src/pages/inbox/report/ReportActionsList.tsx @@ -639,6 +639,9 @@ function ReportActionsList({ * the height of the smallest report action possible. */ const initialNumToRender = useMemo((): number | undefined => { + if (shouldScrollToEndAfterLayout && (!hasCreatedActionAdded || isOffline)) { + return sortedVisibleReportActions.length; + } const minimumReportActionHeight = styles.chatItem.paddingTop + styles.chatItem.paddingBottom + variables.fontSizeNormalHeight; const availableHeight = windowHeight - (CONST.CHAT_FOOTER_MIN_HEIGHT + variables.contentHeaderHeight); const numToRender = Math.ceil(availableHeight / minimumReportActionHeight); @@ -646,7 +649,16 @@ function ReportActionsList({ return getInitialNumToRender(numToRender); } return numToRender || undefined; - }, [styles.chatItem.paddingBottom, styles.chatItem.paddingTop, windowHeight, linkedReportActionID]); + }, [ + styles.chatItem.paddingBottom, + styles.chatItem.paddingTop, + windowHeight, + linkedReportActionID, + shouldScrollToEndAfterLayout, + hasCreatedActionAdded, + sortedVisibleReportActions.length, + isOffline, + ]); /** * Thread's divider line should hide when the first chat in the thread is marked as unread.