Skip to content

Commit 8176a9c

Browse files
authored
Merge pull request Expensify#85526 from Expensify/claude-notFoundPageGoBackToHome
Navigate to Home instead of Inbox from NotFoundPage
2 parents 60c74c9 + 6c2a31c commit 8176a9c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/pages/ErrorPage/NotFoundPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {useRoute} from '@react-navigation/native';
12
import React from 'react';
23
import type {FullPageNotFoundViewProps} from '@components/BlockingViews/FullPageNotFoundView';
34
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
@@ -7,6 +8,8 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
78
import Navigation from '@libs/Navigation/Navigation';
89
import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan';
910
import ONYXKEYS from '@src/ONYXKEYS';
11+
import ROUTES from '@src/ROUTES';
12+
import SCREENS from '@src/SCREENS';
1013

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

2530
useAbsentPageSpan();
2631

@@ -46,6 +51,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe
4651
}}
4752
// eslint-disable-next-line react/jsx-props-no-spreading
4853
{...fullPageNotFoundViewProps}
54+
onLinkPress={isOnGenericErrorScreen ? () => Navigation.goBack(ROUTES.HOME) : fullPageNotFoundViewProps.onLinkPress}
4955
/>
5056
</ScreenWrapper>
5157
);

0 commit comments

Comments
 (0)