From 5aff6434561cfae8eccb5d12ca561cdb9af74f7f Mon Sep 17 00:00:00 2001 From: Cristi Paval Date: Thu, 14 Sep 2023 22:35:41 +0200 Subject: [PATCH] Merge pull request #27270 from tienifr/fix/26824 fix: 26824 Unread messages get marked as read without me visiting the chats (cherry picked from commit a2db0c3f1f9631493eeeffc6af8638caa596ab7b) --- src/pages/home/ReportScreen.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 0e0f5944d3d8..004087c22308 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -247,9 +247,10 @@ function ReportScreen({ useEffect(() => { const unsubscribeVisibilityListener = Visibility.onVisibilityChange(() => { + const isTopMostReportID = Navigation.getTopmostReportId() === getReportID(route); // If the report is not fully visible (AKA on small screen devices and LHR is open) or the report is optimistic (AKA not yet created) // we don't need to call openReport - if (!getIsReportFullyVisible(isTopMostReportId) || report.isOptimisticReport) { + if (!getIsReportFullyVisible(isTopMostReportID) || report.isOptimisticReport) { return; }