From ee29b4023e2462da040927a991bfd22d48f834bf Mon Sep 17 00:00:00 2001 From: devguest Date: Tue, 16 Jul 2024 10:45:21 +0100 Subject: [PATCH] use isSmallScreenWidth only at the chid component DecisionModal --- src/components/MoneyReportHeader.tsx | 1 - src/components/ProcessMoneyReportHoldMenu.tsx | 6 ++---- src/components/ReportActionItem/ReportPreview.tsx | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 6777bbf6c269..69714c7b085a 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -353,7 +353,6 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea nonHeldAmount={!hasOnlyHeldExpenses ? nonHeldAmount : undefined} requestType={requestType} fullAmount={fullAmount} - isSmallScreenWidth={shouldUseNarrowLayout} onClose={() => setIsHoldMenuVisible(false)} isVisible={isHoldMenuVisible} paymentType={paymentType} diff --git a/src/components/ProcessMoneyReportHoldMenu.tsx b/src/components/ProcessMoneyReportHoldMenu.tsx index 872464d8a5b0..4afa7aa4972c 100644 --- a/src/components/ProcessMoneyReportHoldMenu.tsx +++ b/src/components/ProcessMoneyReportHoldMenu.tsx @@ -1,6 +1,7 @@ import React, {useMemo} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; import Navigation from '@libs/Navigation/Navigation'; import {isLinkedTransactionHeld} from '@libs/ReportActionsUtils'; import * as IOU from '@userActions/IOU'; @@ -20,9 +21,6 @@ type ProcessMoneyReportHoldMenuProps = { /** Full amount of expense report to pay */ fullAmount: string; - /** Is the window width narrow, like on a mobile device? */ - isSmallScreenWidth: boolean; - /** Whether modal is visible */ isVisible: boolean; @@ -49,7 +47,6 @@ function ProcessMoneyReportHoldMenu({ requestType, nonHeldAmount, fullAmount, - isSmallScreenWidth = false, onClose, isVisible, paymentType, @@ -59,6 +56,7 @@ function ProcessMoneyReportHoldMenu({ }: ProcessMoneyReportHoldMenuProps) { const {translate} = useLocalize(); const isApprove = requestType === CONST.IOU.REPORT_ACTION_TYPE.APPROVE; + const {isSmallScreenWidth} = useResponsiveLayout(); const onSubmit = (full: boolean) => { if (isApprove) { diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index a435a5723670..15b845d6be70 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -19,7 +19,6 @@ import useNetwork from '@hooks/useNetwork'; import usePermissions from '@hooks/usePermissions'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import useWindowDimensions from '@hooks/useWindowDimensions'; import ControlSelection from '@libs/ControlSelection'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; @@ -129,7 +128,6 @@ function ReportPreview({ const [requestType, setRequestType] = useState(); const [nonHeldAmount, fullAmount] = ReportUtils.getNonHeldAndFullAmount(iouReport, policy); const hasOnlyHeldExpenses = ReportUtils.hasOnlyHeldExpenses(iouReport?.reportID ?? ''); - const {isSmallScreenWidth} = useWindowDimensions(); const [paymentType, setPaymentType] = useState(); const managerID = iouReport?.managerID ?? action.childManagerAccountID ?? 0; @@ -461,7 +459,6 @@ function ReportPreview({ nonHeldAmount={!hasOnlyHeldExpenses ? nonHeldAmount : undefined} requestType={requestType} fullAmount={fullAmount} - isSmallScreenWidth={isSmallScreenWidth} onClose={() => setIsHoldMenuVisible(false)} isVisible={isHoldMenuVisible} paymentType={paymentType}