diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index 8de7f4575e75..0bc233812ca7 100644 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -132,6 +132,8 @@ type AttachmentModalProps = { fallbackSource?: AvatarSource; canEditReceipt?: boolean; + + shouldDisableSendButton?: boolean; }; function AttachmentModal({ @@ -158,6 +160,7 @@ function AttachmentModal({ shouldShowNotFoundPage = false, type = undefined, accountID = undefined, + shouldDisableSendButton = false, }: AttachmentModalProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -589,7 +592,7 @@ function AttachmentModal({ textStyles={[styles.buttonConfirmText]} text={translate('common.send')} onPress={submitAndClose} - isDisabled={isConfirmButtonDisabled} + isDisabled={isConfirmButtonDisabled || shouldDisableSendButton} pressOnEnter /> diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx index 966437a91d31..8ee06151f2f3 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx @@ -88,6 +88,8 @@ type AttachmentPickerWithMenuItemsProps = { /** The personal details of everyone in the report */ reportParticipantIDs?: number[]; + + shouldDisableAttachmentItem?: boolean; }; /** @@ -112,6 +114,7 @@ function AttachmentPickerWithMenuItems({ onItemSelected, actionButtonRef, raiseIsScrollLikelyLayoutTriggered, + shouldDisableAttachmentItem, }: AttachmentPickerWithMenuItemsProps) { const isFocused = useIsFocused(); const theme = useTheme(); @@ -237,6 +240,7 @@ function AttachmentPickerWithMenuItems({ { icon: Expensicons.Paperclip, text: translate('reportActionCompose.addAttachment'), + disabled: shouldDisableAttachmentItem, }, ]; return ( diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 762021163833..9d34fe86c092 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -432,6 +432,7 @@ function ReportActionCompose({ onConfirm={addAttachment} onModalShow={() => setIsAttachmentPreviewActive(true)} onModalHide={onAttachmentPreviewClose} + shouldDisableSendButton={hasExceededMaxCommentLength} > {({displayFileInModal}) => ( <> @@ -451,6 +452,7 @@ function ReportActionCompose({ onAddActionPressed={onAddActionPressed} onItemSelected={onItemSelected} actionButtonRef={actionButtonRef} + shouldDisableAttachmentItem={hasExceededMaxCommentLength} /> {