From 5742ddbdb09863eab00d2bb0efab38a07d0f931e Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 12 Sep 2023 23:37:05 +0700 Subject: [PATCH] fix: 26824 Unread messages get marked as read without me visiting the chats --- 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 5d0cb5ab9bf6..f4f501d287e1 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; }