From bacfcc8734b8190d17c0d288b59a0b4782afe77f Mon Sep 17 00:00:00 2001 From: Huu Le Date: Thu, 19 Sep 2024 22:18:26 +0700 Subject: [PATCH 1/2] fix: chat scroll to bottom on refresh --- src/pages/home/report/ReportActionsList.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 6828e10e7e3b..fe445a0809d8 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -655,7 +655,13 @@ function ReportActionsList({ initialNumToRender={initialNumToRender} onEndReached={onEndReached} onEndReachedThreshold={0.75} - onStartReached={onStartReached} + onStartReached={() => { + InteractionManager.runAfterInteractions(() => { + requestAnimationFrame(() => { + onStartReached(); + }); + }); + }} onStartReachedThreshold={0.75} ListFooterComponent={listFooterComponent} ListHeaderComponent={listHeaderComponent} From 2cbfd5d4ae92a89a3d513a2bbf278bd1010b43a4 Mon Sep 17 00:00:00 2001 From: Huu Le Date: Fri, 20 Sep 2024 07:32:20 +0700 Subject: [PATCH 2/2] fix: delay loading of newer chat until reported list render is complete --- src/pages/home/report/ReportActionsList.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index fe445a0809d8..3e7effb13b96 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -626,7 +626,7 @@ function ReportActionsList({ }, [isLoadingNewerReportActions, canShowHeader, hasLoadingNewerReportActionsError, retryLoadNewerChatsError]); const onStartReached = useCallback(() => { - loadNewerChats(false); + InteractionManager.runAfterInteractions(() => requestAnimationFrame(() => loadNewerChats(false))); }, [loadNewerChats]); const onEndReached = useCallback(() => { @@ -655,13 +655,7 @@ function ReportActionsList({ initialNumToRender={initialNumToRender} onEndReached={onEndReached} onEndReachedThreshold={0.75} - onStartReached={() => { - InteractionManager.runAfterInteractions(() => { - requestAnimationFrame(() => { - onStartReached(); - }); - }); - }} + onStartReached={onStartReached} onStartReachedThreshold={0.75} ListFooterComponent={listFooterComponent} ListHeaderComponent={listHeaderComponent}