Skip to content

Commit

Permalink
fix blank view when report is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Nov 2, 2024
1 parent bef062b commit c2891ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/home/report/withReportOrNotFound.tsx
Original file line number Diff line number Diff line change
@@ -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';

Check failure on line 2 in src/pages/home/report/withReportOrNotFound.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Replace `useIsFocused,·type·RouteProp` with `type·RouteProp,·useIsFocused`

Check failure on line 2 in src/pages/home/report/withReportOrNotFound.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Prefer using a top-level type-only import instead of inline type specifiers
import type {ComponentType, ForwardedRef, RefAttributes} from 'react';
import React, {useEffect} from 'react';
import {useOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit c2891ee

Please sign in to comment.