Skip to content

Commit

Permalink
Merge pull request #54852 from wildan-m/wildan/fix/51763-drop-down-ex…
Browse files Browse the repository at this point in the history
…port-overlap

Fix: Android-Accounting-Export button with dropdown goes out of preview component while loading
  • Loading branch information
srikarparsi authored Jan 7, 2025
2 parents 2e2fd1c + fe486bb commit 96280b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/ReportActionItem/ExportWithDropdownMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, {useCallback, useMemo, useState} from 'react';
import {StyleSheet} from 'react-native';
import type {StyleProp, ViewStyle} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
Expand Down Expand Up @@ -27,6 +29,8 @@ type ExportWithDropdownMenuProps = {
connectionName: ConnectionName;

dropdownAnchorAlignment?: AnchorAlignment;

wrapperStyle?: StyleProp<ViewStyle>;
};

function ExportWithDropdownMenu({
Expand All @@ -37,6 +41,7 @@ function ExportWithDropdownMenu({
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
},
wrapperStyle,
}: ExportWithDropdownMenuProps) {
const reportID = report?.reportID;
const styles = useThemeStyles();
Expand All @@ -50,6 +55,7 @@ function ExportWithDropdownMenu({
const canBeExported = ReportUtils.canBeExported(report);
const isExported = ReportUtils.isExported(reportActions);
const hasIntegrationAutoSync = PolicyUtils.hasIntegrationAutoSync(policy, connectionName);
const flattenedWrapperStyle = StyleSheet.flatten([styles.flex1, wrapperStyle]);

const dropdownOptions: Array<DropdownOption<ReportExportType>> = useMemo(() => {
const optionTemplate = {
Expand All @@ -72,7 +78,7 @@ function ExportWithDropdownMenu({
...optionTemplate,
},
];
const exportMethod = exportMethods?.[report?.policyID ?? ''] ?? null;
const exportMethod = report?.policyID ? exportMethods?.[report.policyID] : null;
if (exportMethod) {
options.sort((method) => (method.value === exportMethod ? -1 : 0));
}
Expand Down Expand Up @@ -124,7 +130,7 @@ function ExportWithDropdownMenu({
onOptionSelected={({value}) => savePreferredExportMethod(value)}
options={dropdownOptions}
style={[shouldUseNarrowLayout && styles.flexGrow1]}
wrapperStyle={styles.flex1}
wrapperStyle={flattenedWrapperStyle}
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
/>
<ConfirmModal
Expand Down
1 change: 1 addition & 0 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ function ReportPreview({
policy={policy}
report={iouReport}
connectionName={connectedIntegration}
wrapperStyle={styles.flexReset}
dropdownAnchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
Expand Down

0 comments on commit 96280b8

Please sign in to comment.