We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ed41d64 + 5a589db commit 9852702Copy full SHA for 9852702
packages/lib/src/file-input/FileInput.tsx
@@ -8,9 +8,9 @@ import FileItem from "./FileItem";
8
import FileInputPropsType, { FileData, RefType } from "./types";
9
10
const getFilePreview = async (file: File): Promise<string> => {
11
- if (file.type.includes("video")) return "filled_movie";
12
- else if (file.type.includes("audio")) return "music_video";
13
- else if (file.type.includes("image")) {
+ if (file?.type?.includes("video")) return "filled_movie";
+ else if (file?.type?.includes("audio")) return "music_video";
+ else if (file?.type?.includes("image")) {
14
return new Promise<string>((resolve) => {
15
const reader = new FileReader();
16
reader.readAsDataURL(file);
0 commit comments