1+ import { useRoute } from '@react-navigation/native' ;
12import React from 'react' ;
23import type { FullPageNotFoundViewProps } from '@components/BlockingViews/FullPageNotFoundView' ;
34import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView' ;
@@ -7,6 +8,8 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
78import Navigation from '@libs/Navigation/Navigation' ;
89import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan' ;
910import ONYXKEYS from '@src/ONYXKEYS' ;
11+ import ROUTES from '@src/ROUTES' ;
12+ import SCREENS from '@src/SCREENS' ;
1013
1114type 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