diff --git a/src/App.tsx b/src/App.tsx index b52d989a5a98..8c5337fbd099 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -38,6 +38,7 @@ import {FullScreenContextProvider} from './components/VideoPlayerContexts/FullSc import {PlaybackContextProvider} from './components/VideoPlayerContexts/PlaybackContext'; import {VideoPopoverMenuContextProvider} from './components/VideoPlayerContexts/VideoPopoverMenuContext'; import {VolumeContextProvider} from './components/VideoPlayerContexts/VolumeContext'; +import WideRHPContextProvider from './components/WideRHPContextProvider'; import {KeyboardStateProvider} from './components/withKeyboardState'; import CONFIG from './CONFIG'; import CONST from './CONST'; @@ -125,6 +126,7 @@ function App() { SidePanelContextProvider, ExpensifyCardContextProvider, KYCWallContextProvider, + WideRHPContextProvider, ]} > diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 664491fe7803..5cd84002c288 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -603,7 +603,7 @@ function MoneyRequestView({ const shouldShowReport = !!parentReportID || !!actualParentReport; const reportCopyValue = !canEditReport ? getReportName(actualParentReport) || actualParentReport?.reportName : undefined; - // In this case we want to use this value. The shouldUseNarrowLayout will always be true as this case is handled when we display ReportScreen in RHP. + // In this case we want to use this value. The shouldUseNarrowLayout will always be true as this case is handled when we display ReportScreen in RHP. // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {isSmallScreenWidth} = useResponsiveLayout(); const {wideRHPRouteKeys} = useContext(WideRHPContext); diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index fa4a8781c7b7..d688395b83db 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -12,7 +12,7 @@ import {SearchContextProvider} from '@components/Search/SearchContext'; import {useSearchRouterContext} from '@components/Search/SearchRouter/SearchRouterContext'; import SearchRouterModal from '@components/Search/SearchRouter/SearchRouterModal'; import SupportalPermissionDeniedModalProvider from '@components/SupportalPermissionDeniedModalProvider'; -import WideRHPContextProvider from '@components/WideRHPContextProvider'; +import {WideRHPContext} from '@components/WideRHPContextProvider'; import useAutoUpdateTimezone from '@hooks/useAutoUpdateTimezone'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useOnboardingFlowRouter from '@hooks/useOnboardingFlow'; @@ -157,6 +157,7 @@ function AuthScreens() { const prevIsOnboardingLoading = usePrevious(isOnboardingLoading); const {initialURL, isAuthenticatedAtStartup, setIsAuthenticatedAtStartup} = useContext(InitialURLContext); const modalCardStyleInterpolator = useModalCardStyleInterpolator(); + const {shouldRenderSecondaryOverlay, dismissToWideReport} = useContext(WideRHPContext); // State to track whether the delegator's authentication is completed before displaying data const [isDelegatorFromOldDotIsReady, setIsDelegatorFromOldDotIsReady] = useState(false); @@ -356,6 +357,11 @@ function AuthScreens() { return; } + if (shouldRenderSecondaryOverlay) { + dismissToWideReport(); + return; + } + Navigation.dismissModal(); }, shortcutConfig.descriptionKey, @@ -364,7 +370,7 @@ function AuthScreens() { true, ); return () => unsubscribeEscapeKey(); - }, [modal?.disableDismissOnEscape, modal?.willAlertModalBecomeVisible]); + }, [dismissToWideReport, modal?.disableDismissOnEscape, modal?.willAlertModalBecomeVisible, shouldRenderSecondaryOverlay]); // Animation is disabled when navigating to the sidebar screen const getWorkspaceSplitNavigatorOptions = ({route}: {route: RouteProp}) => { @@ -478,7 +484,6 @@ function AuthScreens() { LockedAccountModalProvider, DelegateNoAccessModalProvider, SupportalPermissionDeniedModalProvider, - WideRHPContextProvider, ]} > { Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID})); }); diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index a608bc1040f0..6d37f0fa9a7b 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -831,8 +831,11 @@ function ReportScreen({route, navigation}: ReportScreenProps) { // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {isSmallScreenWidth} = useResponsiveLayout(); + // If true reports that are considered MoneyRequest | InvoiceReport will get the new report table view const shouldDisplayMoneyRequestActionsList = isMoneyRequestOrInvoiceReport && shouldDisplayReportTableView(report, visibleTransactions ?? []); + // WideRHP should be visible only on wide layout when report is opened in RHP and contains only one expense. + // This view is only available for reports of type CONST.REPORT.TYPE.EXPENSE or CONST.REPORT.TYPE.IOU. const shouldShowWideRHP = route.name === SCREENS.SEARCH.REPORT_RHP && !isSmallScreenWidth && @@ -853,8 +856,6 @@ function ReportScreen({route, navigation}: ReportScreenProps) { return null; } - // If true reports that are considered MoneyRequest | InvoiceReport will get the new report table view - return ( diff --git a/src/pages/iou/request/step/DiscardChangesConfirmation/index.tsx b/src/pages/iou/request/step/DiscardChangesConfirmation/index.tsx index 4062d7c4b10b..f0712341959f 100644 --- a/src/pages/iou/request/step/DiscardChangesConfirmation/index.tsx +++ b/src/pages/iou/request/step/DiscardChangesConfirmation/index.tsx @@ -69,6 +69,7 @@ function DiscardChangesConfirmation({getHasUnsavedChanges, onCancel}: DiscardCha cancelText={translate('common.cancel')} onConfirm={() => { setIsVisible(false); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { if (blockedNavigationAction.current) { navigationRef.current?.dispatch(blockedNavigationAction.current);