diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 7fba188dcedd..00593d37b626 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -282,17 +282,28 @@ function ReportScreen({ const didSubscribeToReportLeavingEvents = useRef(false); useEffect(() => { - if (!report.reportID || shouldHideReport) { + if (!report.reportID || shouldHideReport || report.reportID !== reportID) { wasReportAccessibleRef.current = false; return; } wasReportAccessibleRef.current = true; - }, [shouldHideReport, report]); + }, [shouldHideReport, report, reportID]); const goBack = useCallback(() => { Navigation.goBack(undefined, false, true); }, []); + const prevReportID = usePrevious(reportID); + + useEffect(() => { + if (prevReportID === reportID) { + return; + } + + wasReportAccessibleRef.current = false; + firstRenderRef.current = true; + }, [reportID, prevReportID]); + let headerView = (