diff --git a/src/components/ParticipantPicker.tsx b/src/components/ParticipantPicker.tsx index 658880bf6459..da31af063b09 100644 --- a/src/components/ParticipantPicker.tsx +++ b/src/components/ParticipantPicker.tsx @@ -59,6 +59,7 @@ function ParticipantPicker({ action={action} isPerDiemRequest={isPerDiemRequest} isTimeRequest={isTimeRequest} + onRestrictedParticipantSelected={onClose} /> ); diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 07a41ac1e0e5..f89892612609 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -41,6 +41,9 @@ type MoneyRequestParticipantsSelectorProps = { /** Whether to find the participant matching initiallySelectedReportID and move it to the top of the list */ shouldMoveSelectedToTop?: boolean; + /** Callback to handle restricted participant selection */ + onRestrictedParticipantSelected?: () => void; + /** Reference to the outer element */ ref?: Ref; }; @@ -62,6 +65,7 @@ function MoneyRequestParticipantsSelector({ isCorporateCardTransaction = false, initiallySelectedReportID, shouldMoveSelectedToTop = false, + onRestrictedParticipantSelected, ref, }: MoneyRequestParticipantsSelectorProps) { const platform = getPlatform(); @@ -95,6 +99,7 @@ function MoneyRequestParticipantsSelector({ onFinish={onFinish} initiallySelectedReportID={initiallySelectedReportID} shouldMoveSelectedToTop={shouldMoveSelectedToTop} + onRestrictedParticipantSelected={onRestrictedParticipantSelected} /> ); } diff --git a/src/pages/iou/request/ParticipantSearchResults.tsx b/src/pages/iou/request/ParticipantSearchResults.tsx index b2b6f6e473bb..b203c273fff0 100644 --- a/src/pages/iou/request/ParticipantSearchResults.tsx +++ b/src/pages/iou/request/ParticipantSearchResults.tsx @@ -100,6 +100,9 @@ type ParticipantSearchResultsProps = { /** Whether to find the participant matching initiallySelectedReportID and move it to the top of the list */ shouldMoveSelectedToTop?: boolean; + + /** Callback to handle restricted participant selection */ + onRestrictedParticipantSelected?: () => void; }; function ParticipantSearchResults({ @@ -118,6 +121,7 @@ function ParticipantSearchResults({ onFinish, initiallySelectedReportID, shouldMoveSelectedToTop = false, + onRestrictedParticipantSelected, }: ParticipantSearchResultsProps) { const getParticipantOptionKey = (option: Partial) => option.reportID ?? option.accountID?.toString() ?? option.login ?? option.phoneNumber ?? ''; const isIOUSplit = iouType === CONST.IOU.TYPE.SPLIT; @@ -453,6 +457,7 @@ function ParticipantSearchResults({ optionPolicy && shouldRestrictUserBillableActions(optionPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, currentUserAccountID) ) { + onRestrictedParticipantSelected?.(); Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(option.policyID)); return; }