From 20a749a5e903bb8628502e08f2cbe5cfcf6b6a4f Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 21 Feb 2024 11:13:56 +0700 Subject: [PATCH] add notfound page --- src/pages/settings/Report/VisibilityPage.tsx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/pages/settings/Report/VisibilityPage.tsx b/src/pages/settings/Report/VisibilityPage.tsx index 797e8406f992..a03068832637 100644 --- a/src/pages/settings/Report/VisibilityPage.tsx +++ b/src/pages/settings/Report/VisibilityPage.tsx @@ -1,7 +1,5 @@ import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useState} from 'react'; -import {withOnyx} from 'react-native-onyx'; -import type {OnyxEntry} from 'react-native-onyx'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import ConfirmModal from '@components/ConfirmModal'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -10,18 +8,14 @@ import SelectionList from '@components/SelectionList'; import useLocalize from '@hooks/useLocalize'; import type {ReportSettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; +import type {WithReportOrNotFoundProps} from '@pages/home/report/withReportOrNotFound'; +import withReportOrNotFound from '@pages/home/report/withReportOrNotFound'; import * as ReportActions from '@userActions/Report'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; -import type {Report} from '@src/types/onyx'; import type {RoomVisibility} from '@src/types/onyx/Report'; -type VisibilityOnyxProps = { - report: OnyxEntry; -}; - -type VisibilityProps = VisibilityOnyxProps & StackScreenProps; +type VisibilityProps = WithReportOrNotFoundProps & StackScreenProps; function VisibilityPage({report}: VisibilityProps) { const [showConfirmModal, setShowConfirmModal] = useState(false); @@ -68,6 +62,7 @@ function VisibilityPage({report}: VisibilityProps) { onBackButtonPress={() => ReportUtils.goBackToDetailsPage(report)} /> { if (option.value === CONST.REPORT.VISIBILITY.PUBLIC) { @@ -98,8 +93,4 @@ function VisibilityPage({report}: VisibilityProps) { VisibilityPage.displayName = 'VisibilityPage'; -export default withOnyx({ - report: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID ?? ''}`, - }, -})(VisibilityPage); +export default withReportOrNotFound()(VisibilityPage);