Skip to content

Commit 96280b8

Browse files
authored
Merge pull request Expensify#54852 from wildan-m/wildan/fix/51763-drop-down-export-overlap
Fix: Android-Accounting-Export button with dropdown goes out of preview component while loading
2 parents 2e2fd1c + fe486bb commit 96280b8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/components/ReportActionItem/ExportWithDropdownMenu.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React, {useCallback, useMemo, useState} from 'react';
2+
import {StyleSheet} from 'react-native';
3+
import type {StyleProp, ViewStyle} from 'react-native';
24
import {useOnyx} from 'react-native-onyx';
35
import type {OnyxEntry} from 'react-native-onyx';
46
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
@@ -27,6 +29,8 @@ type ExportWithDropdownMenuProps = {
2729
connectionName: ConnectionName;
2830

2931
dropdownAnchorAlignment?: AnchorAlignment;
32+
33+
wrapperStyle?: StyleProp<ViewStyle>;
3034
};
3135

3236
function ExportWithDropdownMenu({
@@ -37,6 +41,7 @@ function ExportWithDropdownMenu({
3741
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
3842
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
3943
},
44+
wrapperStyle,
4045
}: ExportWithDropdownMenuProps) {
4146
const reportID = report?.reportID;
4247
const styles = useThemeStyles();
@@ -50,6 +55,7 @@ function ExportWithDropdownMenu({
5055
const canBeExported = ReportUtils.canBeExported(report);
5156
const isExported = ReportUtils.isExported(reportActions);
5257
const hasIntegrationAutoSync = PolicyUtils.hasIntegrationAutoSync(policy, connectionName);
58+
const flattenedWrapperStyle = StyleSheet.flatten([styles.flex1, wrapperStyle]);
5359

5460
const dropdownOptions: Array<DropdownOption<ReportExportType>> = useMemo(() => {
5561
const optionTemplate = {
@@ -72,7 +78,7 @@ function ExportWithDropdownMenu({
7278
...optionTemplate,
7379
},
7480
];
75-
const exportMethod = exportMethods?.[report?.policyID ?? ''] ?? null;
81+
const exportMethod = report?.policyID ? exportMethods?.[report.policyID] : null;
7682
if (exportMethod) {
7783
options.sort((method) => (method.value === exportMethod ? -1 : 0));
7884
}
@@ -124,7 +130,7 @@ function ExportWithDropdownMenu({
124130
onOptionSelected={({value}) => savePreferredExportMethod(value)}
125131
options={dropdownOptions}
126132
style={[shouldUseNarrowLayout && styles.flexGrow1]}
127-
wrapperStyle={styles.flex1}
133+
wrapperStyle={flattenedWrapperStyle}
128134
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
129135
/>
130136
<ConfirmModal

src/components/ReportActionItem/ReportPreview.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ function ReportPreview({
607607
policy={policy}
608608
report={iouReport}
609609
connectionName={connectedIntegration}
610+
wrapperStyle={styles.flexReset}
610611
dropdownAnchorAlignment={{
611612
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
612613
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,

0 commit comments

Comments
 (0)