Skip to content

Commit

Permalink
Prevent user go to next step when press CMD+ENTER
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangzinh committed Nov 2, 2023
1 parent 06879a6 commit 8da24d8
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ function MoneyRequestParticipantsSelector({
const shouldShowSplitBillErrorMessage = participants.length > 1 && hasPolicyExpenseChatParticipant;
const isAllowedToSplit = !isDistanceRequest && iouType !== CONST.IOU.TYPE.SEND;

const handleConfirmSelection = useCallback(() => {
if (shouldShowSplitBillErrorMessage) {
return;
}

navigateToSplit();
}, [shouldShowSplitBillErrorMessage, navigateToSplit])

const footerContent = (
<View>
{shouldShowSplitBillErrorMessage && (
Expand All @@ -281,7 +289,7 @@ function MoneyRequestParticipantsSelector({
<Button
success
text={translate('iou.addToSplit')}
onPress={navigateToSplit}
onPress={handleConfirmSelection}
pressOnEnter
isDisabled={shouldShowSplitBillErrorMessage}
/>
Expand All @@ -304,7 +312,7 @@ function MoneyRequestParticipantsSelector({
headerMessage={headerMessage}
boldStyle
shouldShowConfirmButton={isAllowedToSplit}
onConfirmSelection={navigateToSplit}
onConfirmSelection={handleConfirmSelection}
textInputLabel={translate('optionsSelector.nameEmailOrPhoneNumber')}
textInputAlert={isOffline ? `${translate('common.youAppearToBeOffline')} ${translate('search.resultsAreLimited')}` : ''}
safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle}
Expand Down

0 comments on commit 8da24d8

Please sign in to comment.