From c2891ee95c3afe7ee4f6a0919742eae504eace2a Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 2 Nov 2024 10:49:59 +0800 Subject: [PATCH 1/2] fix blank view when report is deleted --- src/pages/home/report/withReportOrNotFound.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/withReportOrNotFound.tsx b/src/pages/home/report/withReportOrNotFound.tsx index d74dc84249d4..bf14fe75accb 100644 --- a/src/pages/home/report/withReportOrNotFound.tsx +++ b/src/pages/home/report/withReportOrNotFound.tsx @@ -1,5 +1,5 @@ /* eslint-disable rulesdir/no-negated-variables */ -import type {RouteProp} from '@react-navigation/native'; +import {useIsFocused, type RouteProp} from '@react-navigation/native'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {useEffect} from 'react'; import {useOnyx} from 'react-native-onyx'; @@ -60,6 +60,7 @@ export default function ( const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`); const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`); + const isFocused = useIsFocused(); const contentShown = React.useRef(false); const isReportIdInRoute = !!props.route.params.reportID?.length; const isReportLoaded = !isEmptyObject(report) && !!report?.reportID; @@ -86,7 +87,7 @@ export default function ( // If the content was shown, but it's not anymore, that means the report was deleted, and we are probably navigating out of this screen. // Return null for this case to avoid rendering FullScreenLoadingIndicator or NotFoundPage when animating transition. // eslint-disable-next-line react-compiler/react-compiler - if (shouldShowNotFoundPage && contentShown.current) { + if (shouldShowNotFoundPage && contentShown.current && !isFocused) { return null; } From 18ea401ee1e7d9ea2e7dcc2b4f861c77d14f5b7b Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 2 Nov 2024 10:56:29 +0800 Subject: [PATCH 2/2] lint --- src/pages/home/report/withReportOrNotFound.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/withReportOrNotFound.tsx b/src/pages/home/report/withReportOrNotFound.tsx index bf14fe75accb..b42e9ca5e878 100644 --- a/src/pages/home/report/withReportOrNotFound.tsx +++ b/src/pages/home/report/withReportOrNotFound.tsx @@ -1,5 +1,6 @@ /* eslint-disable rulesdir/no-negated-variables */ -import {useIsFocused, type RouteProp} from '@react-navigation/native'; +import type {RouteProp} from '@react-navigation/native'; +import {useIsFocused} from '@react-navigation/native'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {useEffect} from 'react'; import {useOnyx} from 'react-native-onyx';