Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/pages/ErrorPage/NotFoundPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useRoute} from '@react-navigation/native';
import React from 'react';
import type {FullPageNotFoundViewProps} from '@components/BlockingViews/FullPageNotFoundView';
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
Expand All @@ -7,6 +8,8 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import Navigation from '@libs/Navigation/Navigation';
import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';

type NotFoundPageProps = {
onBackButtonPress?: () => void;
Expand All @@ -21,6 +24,8 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe
const {isSmallScreenWidth} = useResponsiveLayout();
const topmostReportId = Navigation.getTopmostReportId();
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${topmostReportId}`);
const route = useRoute();
const isOnGenericErrorScreen = route.name === SCREENS.NOT_FOUND;

useAbsentPageSpan();

Expand All @@ -46,6 +51,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe
}}
// eslint-disable-next-line react/jsx-props-no-spreading
{...fullPageNotFoundViewProps}
onLinkPress={isOnGenericErrorScreen ? () => Navigation.goBack(ROUTES.HOME) : fullPageNotFoundViewProps.onLinkPress}
/>
</ScreenWrapper>
);
Expand Down
Loading