diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index 667c84432684..c915b2f227aa 100755 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -63,12 +63,12 @@ type AttachmentModalOnyxProps = { }; type ImagePickerResponse = { - height: number; + height?: number; name: string; - size: number; + size?: number | null; type: string; uri: string; - width: number; + width?: number; }; type FileObject = Partial; @@ -284,14 +284,14 @@ function AttachmentModal({ }, [transaction, report]); const isValidFile = useCallback((fileObject: FileObject) => { - if (fileObject.size !== undefined && fileObject.size > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) { + if (fileObject.size && fileObject.size > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) { setIsAttachmentInvalid(true); setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooLarge'); setAttachmentInvalidReason('attachmentPicker.sizeExceeded'); return false; } - if (fileObject.size !== undefined && fileObject.size < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) { + if (fileObject.size && fileObject.size < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) { setIsAttachmentInvalid(true); setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooSmall'); setAttachmentInvalidReason('attachmentPicker.sizeNotMet'); @@ -627,4 +627,4 @@ export default withOnyx({ }, })(memo(AttachmentModal)); -export type {FileObject}; +export type {Attachment, FileObject, ImagePickerResponse}; diff --git a/src/components/AttachmentPicker/attachmentPickerPropTypes.js b/src/components/AttachmentPicker/attachmentPickerPropTypes.js deleted file mode 100644 index a3a346f5ea27..000000000000 --- a/src/components/AttachmentPicker/attachmentPickerPropTypes.js +++ /dev/null @@ -1,33 +0,0 @@ -import PropTypes from 'prop-types'; -import CONST from '@src/CONST'; - -const propTypes = { - /** - * A renderProp with the following interface - * - * @example - * - * {({openPicker}) => ( - *