Skip to content

Commit f28696a

Browse files
authored
Merge pull request #54944 from callstack-internal/fix/FloatingMessageCounter-optimization
Add useCallback to avoid unnecessary rerenders of FloatingMessageCounter
2 parents 9b31270 + c3ec796 commit f28696a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pages/home/report/ReportActionsList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ function ReportActionsList({
514514
onScroll?.(event);
515515
};
516516

517-
const scrollToBottomAndMarkReportAsRead = () => {
517+
const scrollToBottomAndMarkReportAsRead = useCallback(() => {
518518
if (!hasNewestReportAction) {
519519
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
520520
openReport(report.reportID);
@@ -524,7 +524,7 @@ function ReportActionsList({
524524
reportScrollManager.scrollToBottom();
525525
readActionSkipped.current = false;
526526
readNewestAction(report.reportID);
527-
};
527+
}, [report.reportID, reportScrollManager, hasNewestReportAction]);
528528

529529
/**
530530
* Calculates the ideal number of report actions to render in the first render, based on the screen height and on

0 commit comments

Comments
 (0)