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 005ca4df153a..31c5c6fc891f 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx @@ -86,6 +86,8 @@ type AttachmentPickerWithMenuItemsProps = { /** The personal details of everyone in the report */ reportParticipantIDs?: number[]; + + shouldDisableAttachmentItem?: boolean; }; /** @@ -110,6 +112,7 @@ function AttachmentPickerWithMenuItems({ onItemSelected, actionButtonRef, raiseIsScrollLikelyLayoutTriggered, + shouldDisableAttachmentItem, }: AttachmentPickerWithMenuItemsProps) { const isFocused = useIsFocused(); const theme = useTheme(); @@ -236,6 +239,7 @@ function AttachmentPickerWithMenuItems({ triggerAttachmentPicker(); }, shouldCallAfterModalHide: true, + disabled: shouldDisableAttachmentItem, }, ]; return ( diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 4a2dc6dc0781..39786e15c621 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} /> {