Skip to content

Commit 00778b8

Browse files
Close dropdown menu before navigating to restricted action page
The duplicate action handlers have shouldCloseModalOnSelect set to false, so the dropdown menu stays open when the billing restriction guard triggers navigation to ROUTES.RESTRICTED_ACTION, causing them to overlap. Co-authored-by: Eugene Voloshchak <eVoloshchak@users.noreply.github.com>
1 parent 0f3fb24 commit 00778b8

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/components/MoneyRequestHeaderSecondaryActions.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
358358
defaultExpensePolicy &&
359359
shouldRestrictUserBillableActions(defaultExpensePolicy.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, defaultExpensePolicy)
360360
) {
361+
dropdownMenuRef.current?.setIsMenuVisible(false);
361362
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(defaultExpensePolicy.id));
362363
return;
363364
}

src/hooks/useExpenseActions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
321321
defaultExpensePolicy &&
322322
shouldRestrictUserBillableActions(defaultExpensePolicy.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, defaultExpensePolicy)
323323
) {
324+
onDuplicateReset?.();
324325
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(defaultExpensePolicy.id));
325326
return;
326327
}
@@ -384,6 +385,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
384385
targetPolicyForDuplicate &&
385386
shouldRestrictUserBillableActions(targetPolicyForDuplicate.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, targetPolicyForDuplicate)
386387
) {
388+
onDuplicateReset?.();
387389
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(targetPolicyForDuplicate.id));
388390
return;
389391
}

0 commit comments

Comments
 (0)