@@ -2,13 +2,15 @@ import {delegateEmailSelector, isUserValidatedSelector} from '@selectors/Account
22import { hasSeenTourSelector } from '@selectors/Onboarding' ;
33import truncate from 'lodash/truncate' ;
44import React , { useContext , useEffect } from 'react' ;
5- import { InteractionManager } from 'react-native' ;
5+ import { InteractionManager , View } from 'react-native' ;
66import type { ValueOf } from 'type-fest' ;
7+ import Button from '@components/Button' ;
78import type { ButtonWithDropdownMenuRef } from '@components/ButtonWithDropdownMenu/types' ;
89import { useDelegateNoAccessActions , useDelegateNoAccessState } from '@components/DelegateNoAccessModalProvider' ;
910import { KYCWallContext } from '@components/KYCWall/KYCWallContext' ;
1011import MoneyReportHeaderKYCDropdown from '@components/MoneyReportHeaderKYCDropdown' ;
1112import { useMoneyReportHeaderModals } from '@components/MoneyReportHeaderModalsContext' ;
13+ import NavigationDeferredMount from '@components/NavigationDeferredMount' ;
1214import { usePaymentAnimationsContext } from '@components/PaymentAnimationsContext' ;
1315import type { PopoverMenuItem } from '@components/PopoverMenu' ;
1416import { useSearchStateContext } from '@components/Search/SearchContext' ;
@@ -30,7 +32,10 @@ import usePaymentOptions from '@hooks/usePaymentOptions';
3032import usePermissions from '@hooks/usePermissions' ;
3133import usePolicy from '@hooks/usePolicy' ;
3234import useReportIsArchived from '@hooks/useReportIsArchived' ;
35+ import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
3336import useSearchShouldCalculateTotals from '@hooks/useSearchShouldCalculateTotals' ;
37+ import useStyleUtils from '@hooks/useStyleUtils' ;
38+ import useThemeStyles from '@hooks/useThemeStyles' ;
3439import useTransactionsAndViolationsForReport from '@hooks/useTransactionsAndViolationsForReport' ;
3540import { generateDefaultWorkspaceName } from '@libs/actions/Policy/Policy' ;
3641import { search } from '@libs/actions/Search' ;
@@ -394,15 +399,45 @@ function MoneyReportHeaderSecondaryActionsInner({reportID, primaryAction, isRepo
394399 ) ;
395400}
396401
402+ function MoneyReportHeaderSecondaryActionsPlaceholder ( { primaryAction} : { primaryAction : ValueOf < typeof CONST . REPORT . PRIMARY_ACTIONS > | '' } ) {
403+ const styles = useThemeStyles ( ) ;
404+ const StyleUtils = useStyleUtils ( ) ;
405+ const { translate} = useLocalize ( ) ;
406+ const { shouldUseNarrowLayout, isMediumScreenWidth} = useResponsiveLayout ( ) ;
407+ const icons = useMemoizedLazyExpensifyIcons ( [ 'DownArrow' ] ) ;
408+ const shouldDisplayNarrowVersion = shouldUseNarrowLayout || isMediumScreenWidth ;
409+ const wrapperStyle = shouldDisplayNarrowVersion && ! primaryAction ? styles . flex1 : undefined ;
410+ // Match the inner styles the real ButtonWithDropdownMenu applies when isSplitButton=false so text placement stays put on swap.
411+ const innerStyles = [ StyleUtils . getDropDownButtonHeight ( CONST . DROPDOWN_BUTTON_SIZE . MEDIUM ) , styles . dropDownButtonCartIconView ] ;
412+ return (
413+ < View style = { wrapperStyle } >
414+ < Button
415+ text = { translate ( 'common.more' ) }
416+ iconRight = { icons . DownArrow }
417+ shouldShowRightIcon
418+ innerStyles = { innerStyles }
419+ onPress = { ( ) => { } }
420+ />
421+ </ View >
422+ ) ;
423+ }
424+
397425function MoneyReportHeaderSecondaryActions ( { reportID, primaryAction, isReportInSearch, backTo, dropdownMenuRef} : MoneyReportHeaderSecondaryActionsProps ) {
398426 return (
399- < MoneyReportHeaderSecondaryActionsInner
400- reportID = { reportID }
401- primaryAction = { primaryAction }
402- isReportInSearch = { isReportInSearch }
403- backTo = { backTo }
404- dropdownMenuRef = { dropdownMenuRef }
405- />
427+ < NavigationDeferredMount
428+ placeholder = { < MoneyReportHeaderSecondaryActionsPlaceholder primaryAction = { primaryAction } /> }
429+ // RHPReportScreen remounts this tree on setParams arrow-nav without firing a transition,
430+ // so we must not wait for one — see https://github.com/Expensify/App/issues/88931.
431+ waitForUpcomingTransition = { false }
432+ >
433+ < MoneyReportHeaderSecondaryActionsInner
434+ reportID = { reportID }
435+ primaryAction = { primaryAction }
436+ isReportInSearch = { isReportInSearch }
437+ backTo = { backTo }
438+ dropdownMenuRef = { dropdownMenuRef }
439+ />
440+ </ NavigationDeferredMount >
406441 ) ;
407442}
408443
0 commit comments