Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions src/components/MoneyRequestReportView/SelectionToolbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DecisionModal from '@components/DecisionModal';
import {useDelegateNoAccessActions, useDelegateNoAccessState} from '@components/DelegateNoAccessModalProvider';
import HoldOrRejectEducationalModal from '@components/HoldOrRejectEducationalModal';
import {ModalActions} from '@components/Modal/Global/ModalContext';
Expand All @@ -10,6 +9,7 @@ import BulkDuplicateHandler from '@components/Search/BulkDuplicateHandler';
import {useSearchSelectionActions, useSearchSelectionContext} from '@components/Search/SearchContext';

import useConfirmModal from '@hooks/useConfirmModal';
import useDecisionModal from '@hooks/useDecisionModal';
import useFilterSelectedTransactions from '@hooks/useFilterSelectedTransactions';
import useLocalize from '@hooks/useLocalize';
import useMobileSelectionMode from '@hooks/useMobileSelectionMode';
Expand Down Expand Up @@ -91,9 +91,24 @@ function SelectionToolbar({reportID, transactions, reportActions}: SelectionTool

const isMobileSelectionModeEnabled = useMobileSelectionMode();
const {showConfirmModal} = useConfirmModal();
const {showDecisionModal} = useDecisionModal();

const showOfflineModal = () => {
showDecisionModal({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Delay the global alert until the export popover closes

On Android, when an offline user selects an export option from the report selection toolbar, this synchronously presents the global native modal before ButtonWithDropdownMenu finishes dismissing its popover. The overlapping modals leave the alert stuck: neither “Got it” nor hardware Back responds, and the report remains blocked. Present this alert from the popover's post-dismiss callback or otherwise defer it until the originating menu has fully closed.

Useful? React with 👍 / 👎.

@ZhenjaHorbach ZhenjaHorbach Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot
Can't reproduce
But makes sense, and we can add these changes just in case

diff --git a/src/hooks/useSelectedTransactionsActions.ts b/src/hooks/useSelectedTransactionsActions.ts
index bd88e40df03f40..904ab27f5107ca 100644
--- a/src/hooks/useSelectedTransactionsActions.ts
+++ b/src/hooks/useSelectedTransactionsActions.ts
@@ -466,6 +466,7 @@ function useSelectedTransactionsActions({
                               clearSelectedTransactions(true);
                           }
                         : () => beginExportWithTemplate(template.templateName, template.type, selectedTransactionIDs, template.name, template.policyID),
+                    shouldCallAfterModalHide: true,
                     addSeparatorBefore,
                 };
             };

title: translate('common.youAppearToBeOffline'),
prompt: translate('common.offlinePrompt'),
secondOptionText: translate('common.buttonConfirm'),
});
};

const showDownloadErrorModal = () => {
showDecisionModal({
title: translate('common.downloadFailedTitle'),
prompt: translate('common.downloadFailedDescription'),
secondOptionText: translate('common.buttonConfirm'),
});
};

const [offlineModalVisible, setOfflineModalVisible] = useState(false);
const [isDownloadErrorModalVisible, setIsDownloadErrorModalVisible] = useState(false);
const [rejectModalAction, setRejectModalAction] = useState<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT_BULK> | null>(null);

const transactionsWithoutPendingDelete = transactions.filter((t) => !isTransactionPendingDelete(t));
Expand All @@ -102,7 +117,7 @@ function SelectionToolbar({reportID, transactions, reportActions}: SelectionTool

const beginExportWithTemplate = (templateName: string, templateType: string, transactionIDList: string[], exportName: string) => {
if (isOffline) {
setOfflineModalVisible(true);
showOfflineModal();
return;
}

Expand Down Expand Up @@ -164,8 +179,8 @@ function SelectionToolbar({reportID, transactions, reportActions}: SelectionTool
reportActions,
allTransactionsLength: transactions.length,
session,
onExportFailed: () => setIsDownloadErrorModalVisible(true),
onExportOffline: () => setOfflineModalVisible(true),
onExportFailed: showDownloadErrorModal,
onExportOffline: showOfflineModal,
policy,
beginExportWithTemplate: (templateName, templateType, transactionIDList, exportName) => beginExportWithTemplate(templateName, templateType, transactionIDList, exportName),
onDeleteSelected,
Expand Down Expand Up @@ -306,24 +321,6 @@ function SelectionToolbar({reportID, transactions, reportActions}: SelectionTool
onClearSelection={() => clearSelectedTransactions(true)}
/>
)}
<DecisionModal
title={translate('common.downloadFailedTitle')}
prompt={translate('common.downloadFailedDescription')}
isSmallScreenWidth={shouldUseNarrowLayout}
onSecondOptionSubmit={() => setIsDownloadErrorModalVisible(false)}
secondOptionText={translate('common.buttonConfirm')}
isVisible={isDownloadErrorModalVisible}
onClose={() => setIsDownloadErrorModalVisible(false)}
/>
<DecisionModal
title={translate('common.youAppearToBeOffline')}
prompt={translate('common.offlinePrompt')}
isSmallScreenWidth={shouldUseNarrowLayout}
onSecondOptionSubmit={() => setOfflineModalVisible(false)}
secondOptionText={translate('common.buttonConfirm')}
isVisible={offlineModalVisible}
onClose={() => setOfflineModalVisible(false)}
/>
{!!rejectModalAction && (
<HoldOrRejectEducationalModal
onClose={dismissRejectModalBasedOnAction}
Expand Down
39 changes: 1 addition & 38 deletions src/components/Search/SearchBulkActionsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BulkActionBar from '@components/BulkActionBar';
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
import DecisionModal from '@components/DecisionModal';
import {useDelegateNoAccessActions, useDelegateNoAccessState} from '@components/DelegateNoAccessModalProvider';
import ExpensifyCardStatementPDFDownloadModal from '@components/ExpensifyCardStatementPDFDownloadModal';
import HoldOrRejectEducationalModal from '@components/HoldOrRejectEducationalModal';
Expand Down Expand Up @@ -51,9 +50,7 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
const {pageGutter} = useLayoutSpacing();
const {translate} = useLocalize();
const {isOffline} = useNetwork();
// We need isSmallScreenWidth (not just shouldUseNarrowLayout) because DecisionModal requires it for correct modal type
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {selectedTransactions, excludedTransactions = getEmptyObject<SelectedTransactions>(), selectedReports, areAllMatchingItemsSelected} = useSearchSelectionContext();
const {clearSelectedTransactions} = useSearchSelectionActions();
const {currentSearchResults} = useSearchResultsContext();
Expand All @@ -80,20 +77,13 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
selectedReportIDs,
businessBankAccountOptions,
confirmPayment,
isOfflineModalVisible,
isDownloadErrorModalVisible,
isHoldEducationalModalVisible,
areAllTransactionsFromDMReports,
rejectModalAction,
emptyReportsCount,
handleOfflineModalClose,
handleDownloadErrorModalClose,
isExpensifyCardStatementPDFModalVisible,
setIsExpensifyCardStatementPDFModalVisible,
expensifyCardStatementPDFParams,
handleExpensifyCardStatementPDFModalHide,
isExpensifyCardStatementMultiFeedAlertVisible,
handleExpensifyCardStatementMultiFeedAlertClose,
dismissModalAndUpdateUseHold,
dismissRejectModalBasedOnAction,
isDuplicateOptionVisible,
Expand Down Expand Up @@ -273,24 +263,6 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
)
}
</KYCWall>
<DecisionModal
title={translate('common.youAppearToBeOffline')}
prompt={translate('common.offlinePrompt')}
isSmallScreenWidth={isSmallScreenWidth}
onSecondOptionSubmit={handleOfflineModalClose}
secondOptionText={translate('common.buttonConfirm')}
isVisible={isOfflineModalVisible}
onClose={handleOfflineModalClose}
/>
<DecisionModal
title={translate('common.downloadFailedTitle')}
prompt={emptyReportsCount ? translate('common.downloadFailedEmptyReportDescription', {count: emptyReportsCount}) : translate('common.downloadFailedDescription')}
isSmallScreenWidth={isSmallScreenWidth}
onSecondOptionSubmit={handleDownloadErrorModalClose}
secondOptionText={translate('common.buttonConfirm')}
isVisible={isDownloadErrorModalVisible}
onClose={handleDownloadErrorModalClose}
/>
{!!expensifyCardStatementPDFParams && (
<ExpensifyCardStatementPDFDownloadModal
statementParams={expensifyCardStatementPDFParams}
Expand All @@ -299,15 +271,6 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
onModalHide={handleExpensifyCardStatementPDFModalHide}
/>
)}
<DecisionModal
title={translate('search.expensifyCardStatementPDF.title')}
prompt={translate('search.expensifyCardStatementPDF.oneFeedAtATime')}
isSmallScreenWidth={isSmallScreenWidth}
onSecondOptionSubmit={handleExpensifyCardStatementMultiFeedAlertClose}
secondOptionText={translate('common.buttonConfirm')}
isVisible={isExpensifyCardStatementMultiFeedAlertVisible}
onClose={handleExpensifyCardStatementMultiFeedAlertClose}
/>
{!!rejectModalAction && (
<HoldOrRejectEducationalModal
onClose={dismissRejectModalBasedOnAction}
Expand Down
Loading
Loading