Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS migration] Migrate 'AttachmentPicker' component to TypeScript #37810

Merged
merged 36 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d64a997
Migrate 'AttachmentPicker' component to TypeScript
dukenv0307 Mar 4, 2024
049f950
fix: type in launch camera
dukenv0307 Mar 4, 2024
d34c62b
fix type select item function
dukenv0307 Mar 5, 2024
cd2681e
fix type
dukenv0307 Mar 6, 2024
e8f9f8f
Merge branch 'main' into fix/25134
dukenv0307 Mar 6, 2024
2dda80f
fix: type attachment
dukenv0307 Mar 6, 2024
9ac6e89
fix lint
dukenv0307 Mar 6, 2024
ea868c3
Merge branch 'main' into fix/25134
dukenv0307 Mar 11, 2024
1e3abba
fix type launch camera
dukenv0307 Mar 11, 2024
fc29a73
fix: lint
dukenv0307 Mar 11, 2024
d4401b8
Merge branch 'main' into fix/25134
dukenv0307 Mar 13, 2024
8e5a242
fix type attachment picker
dukenv0307 Mar 13, 2024
564b7d5
fix lint
dukenv0307 Mar 13, 2024
1ab9c3c
fix type attachment
dukenv0307 Mar 13, 2024
7d4f876
Merge branch 'main' into fix/25134
dukenv0307 Mar 15, 2024
1450ea9
fix type attchment picker
dukenv0307 Mar 15, 2024
b729ae6
fix type attachment picker
dukenv0307 Mar 18, 2024
5c2f60a
Merge branch 'main' into fix/25134
dukenv0307 Mar 19, 2024
d73fe5d
fix: fallback in show general alert
dukenv0307 Mar 19, 2024
397feff
Merge branch 'main' into fix/25134
dukenv0307 Mar 20, 2024
8d405ff
fix type attachment picker
dukenv0307 Mar 21, 2024
166a616
fix typecheck
dukenv0307 Mar 21, 2024
d8e484c
Merge branch 'main' into fix/25134
dukenv0307 Mar 21, 2024
1ae4e2b
fix lint
dukenv0307 Mar 21, 2024
78a345e
Update src/components/AttachmentPicker/index.native.tsx
dukenv0307 Mar 25, 2024
9f94ba9
Merge branch 'main' into fix/25134
dukenv0307 Mar 25, 2024
9e39089
fix: eslint
dukenv0307 Mar 25, 2024
d3b891e
Update src/components/AttachmentPicker/types.ts
dukenv0307 Mar 26, 2024
b0fd19e
Add description for each property
dukenv0307 Mar 26, 2024
b41cebe
merge main
dukenv0307 Mar 26, 2024
594fafa
fix type check
dukenv0307 Mar 26, 2024
be0c526
fix type check
dukenv0307 Mar 26, 2024
eba576e
Merge branch 'main' into fix/25134
dukenv0307 Mar 26, 2024
21cb31b
import lanchCamera with alias name
dukenv0307 Mar 26, 2024
9c26f07
add new line
dukenv0307 Mar 26, 2024
640283e
fix lint
dukenv0307 Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<File | ImagePickerResponse>;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -627,4 +627,4 @@ export default withOnyx<AttachmentModalProps, AttachmentModalOnyxProps>({
},
})(memo(AttachmentModal));

export type {FileObject};
export type {Attachment, FileObject, ImagePickerResponse};
33 changes: 0 additions & 33 deletions src/components/AttachmentPicker/attachmentPickerPropTypes.js

This file was deleted.

Loading
Loading