Skip to content

Commit e535b64

Browse files
authored
Merge pull request Expensify#65883 from FitseTLT/fix-more-content-logic-on-money-report-header
Fix - The "More" button in the header disappears after selecting IOU on a medium-sized screen width
2 parents 8209632 + d37edcc commit e535b64

1 file changed

Lines changed: 36 additions & 27 deletions

File tree

src/components/MoneyReportHeader.tsx

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ function MoneyReportHeader({
428428
};
429429

430430
const statusBarProps = getStatusBarProps();
431-
const shouldAddGapToContents = shouldUseNarrowLayout && shouldShowSelectedTransactionsButton && (!!statusBarProps || shouldShowNextStep);
432431

433432
useEffect(() => {
434433
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
@@ -885,8 +884,6 @@ function MoneyReportHeader({
885884

886885
const shouldShowBackButton = shouldDisplayBackButton || shouldUseNarrowLayout;
887886

888-
const isMoreContentShown = shouldShowNextStep || !!statusBarProps;
889-
890887
const connectedIntegrationName = connectedIntegration ? translate('workspace.accounting.connectionName', {connectionName: connectedIntegration}) : '';
891888
const unapproveWarningText = useMemo(
892889
() => (
@@ -957,6 +954,41 @@ function MoneyReportHeader({
957954
</KYCWall>
958955
);
959956

957+
const moreContentUnfiltered = [
958+
shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && (
959+
<View
960+
style={[styles.dFlex, styles.w100, styles.pb3]}
961+
key="1"
962+
>
963+
<ButtonWithDropdownMenu
964+
onPress={() => null}
965+
options={selectedTransactionsOptions}
966+
customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})}
967+
isSplitButton={false}
968+
shouldAlwaysShowDropdownMenu
969+
wrapperStyle={styles.w100}
970+
/>
971+
</View>
972+
),
973+
shouldShowNextStep && !!optimisticNextStep?.message?.length && (
974+
<MoneyReportHeaderStatusBar
975+
nextStep={optimisticNextStep}
976+
key="2"
977+
/>
978+
),
979+
shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && <MoneyReportHeaderStatusBarSkeleton key="3" />,
980+
!!statusBarProps && (
981+
<MoneyRequestHeaderStatusBar
982+
icon={statusBarProps.icon}
983+
description={statusBarProps.description}
984+
key="4"
985+
/>
986+
),
987+
];
988+
const moreContent = moreContentUnfiltered.filter(Boolean);
989+
const isMoreContentShown = moreContent.length > 0;
990+
const shouldAddGapToContents = moreContent.length > 1;
991+
960992
return (
961993
<View style={[styles.pt0, styles.borderBottom]}>
962994
<HeaderWithBackButton
@@ -995,30 +1027,7 @@ function MoneyReportHeader({
9951027
{!!applicableSecondaryActions.length && KYCMoreDropdown}
9961028
</View>
9971029
)}
998-
{isMoreContentShown && (
999-
<View style={[styles.dFlex, styles.flexColumn, shouldAddGapToContents && styles.gap3, styles.pb3, styles.ph5]}>
1000-
{shouldShowSelectedTransactionsButton && shouldDisplayNarrowVersion && (
1001-
<View style={[styles.dFlex, styles.w100, styles.pb3]}>
1002-
<ButtonWithDropdownMenu
1003-
onPress={() => null}
1004-
options={selectedTransactionsOptions}
1005-
customText={translate('workspace.common.selected', {count: selectedTransactionIDs.length})}
1006-
isSplitButton={false}
1007-
shouldAlwaysShowDropdownMenu
1008-
wrapperStyle={styles.w100}
1009-
/>
1010-
</View>
1011-
)}
1012-
{shouldShowNextStep && !!optimisticNextStep?.message?.length && <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} />}
1013-
{shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline && <MoneyReportHeaderStatusBarSkeleton />}
1014-
{!!statusBarProps && (
1015-
<MoneyRequestHeaderStatusBar
1016-
icon={statusBarProps.icon}
1017-
description={statusBarProps.description}
1018-
/>
1019-
)}
1020-
</View>
1021-
)}
1030+
{isMoreContentShown && <View style={[styles.dFlex, styles.flexColumn, shouldAddGapToContents && styles.gap3, styles.pb3, styles.ph5]}>{moreContent}</View>}
10221031
<LoadingBar shouldShow={shouldShowLoadingBar && shouldUseNarrowLayout} />
10231032
{isHoldMenuVisible && requestType !== undefined && (
10241033
<ProcessMoneyReportHoldMenu

0 commit comments

Comments
 (0)