Skip to content

Commit

Permalink
feat: Exposed types for doc, ppt and xls files (#348)
Browse files Browse the repository at this point in the history
* Exposed types for doc, ppt and xls files

Updated mimetypes, utis and extensions to include doc, powerpoint and excel types.
Now the types above can be accessed through ocumentPicker.types.*

* Update syntax to match lint patterns

* Specified OpenXML formats
  • Loading branch information
luizppa authored Oct 28, 2020
1 parent c31f16b commit 0bf24c2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
24 changes: 21 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,48 @@ declare module 'react-native-document-picker' {
allFiles: '*/*';
audio: 'audio/*';
csv: 'text/csv';
doc: 'application/msword';
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
images: 'image/*';
plainText: 'text/plain';
pdf: 'application/pdf';
plainText: 'text/plain';
ppt: 'application/vnd.ms-powerpoint';
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
video: 'video/*';
xls: 'application/vnd.ms-excel';
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
zip: 'application/zip';
};
utis: {
allFiles: 'public.content';
audio: 'public.audio';
csv: 'public.comma-separated-values-text';
doc: 'com.microsoft.word.doc';
docx: 'org.openxmlformats.wordprocessingml.document';
images: 'public.image';
plainText: 'public.plain-text';
pdf: 'com.adobe.pdf';
plainText: 'public.plain-text';
ppt: 'com.microsoft.powerpoint.ppt';
pptx: 'org.openxmlformats.presentationml.presentation';
video: 'public.movie';
xls: 'com.microsoft.excel.xls';
xlsx: 'org.openxmlformats.spreadsheetml.sheet';
zip: 'public.zip-archive';
};
extensions: {
allFiles: '*';
audio: '.3g2 .3gp .aac .adt .adts .aif .aifc .aiff .asf .au .m3u .m4a .m4b .mid .midi .mp2 .mp3 .mp4 .rmi .snd .wav .wax .wma';
csv: '.csv';
doc: '.doc';
docx: '.docx';
images: '.jpeg .jpg .png';
plainText: '.txt';
pdf: '.pdf';
plainText: '.txt';
ppt: '.ppt';
pptx: '.pptx';
video: '.mp4';
xls: '.xls';
xlsx: '.xlsx';
zip: '.zip .gz';
};
};
Expand Down
24 changes: 21 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,49 @@ const Types = {
allFiles: '*/*',
audio: 'audio/*',
csv: 'text/csv',
doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
images: 'image/*',
plainText: 'text/plain',
pdf: 'application/pdf',
plainText: 'text/plain',
ppt: 'application/vnd.ms-powerpoint',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
video: 'video/*',
xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
zip: 'application/zip',
},
utis: {
allFiles: 'public.content',
audio: 'public.audio',
csv: 'public.comma-separated-values-text',
doc: 'com.microsoft.word.doc',
docx: 'org.openxmlformats.wordprocessingml.document',
images: 'public.image',
plainText: 'public.plain-text',
pdf: 'com.adobe.pdf',
plainText: 'public.plain-text',
ppt: 'com.microsoft.powerpoint.ppt',
pptx: 'org.openxmlformats.presentationml.presentation',
video: 'public.movie',
xls: 'com.microsoft.excel.xls',
xlsx: 'org.openxmlformats.spreadsheetml.sheet',
zip: 'public.zip-archive',
},
extensions: {
allFiles: '*',
audio:
'.3g2 .3gp .aac .adt .adts .aif .aifc .aiff .asf .au .m3u .m4a .m4b .mid .midi .mp2 .mp3 .mp4 .rmi .snd .wav .wax .wma',
csv: '.csv',
doc: '.doc',
docx: '.docx',
images: '.jpeg .jpg .png',
plainText: '.txt',
pdf: '.pdf',
plainText: '.txt',
ppt: '.ppt',
pptx: '.pptx',
video: '.mp4',
xls: '.xls',
xlsx: '.xlsx',
zip: '.zip .gz',
},
};
Expand Down

0 comments on commit 0bf24c2

Please sign in to comment.