Skip to content

Commit c5102ee

Browse files
MelvinBotbernhardoj
andcommitted
Revert NotFoundPage changes per reviewer feedback
Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
1 parent 6c46ef3 commit c5102ee

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/pages/ErrorPage/NotFoundPage.tsx

Lines changed: 7 additions & 1 deletion
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,9 @@ 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;
29+
2430
useAbsentPageSpan();
2531

2632
return (
@@ -45,7 +51,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe
4551
}}
4652
// eslint-disable-next-line react/jsx-props-no-spreading
4753
{...fullPageNotFoundViewProps}
48-
onLinkPress={fullPageNotFoundViewProps.onLinkPress}
54+
onLinkPress={isOnGenericErrorScreen ? () => Navigation.goBack(ROUTES.HOME) : fullPageNotFoundViewProps.onLinkPress}
4955
/>
5056
</ScreenWrapper>
5157
);

0 commit comments

Comments
 (0)