From 36d66d8a1d7174a97233145815738a6b05833365 Mon Sep 17 00:00:00 2001 From: Luiz Philippe Date: Fri, 25 Sep 2020 10:54:40 -0300 Subject: [PATCH 1/3] 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.* --- index.d.ts | 18 ++++++++++++++---- index.js | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/index.d.ts b/index.d.ts index 42ef9e59..ad2573fa 100644 --- a/index.d.ts +++ b/index.d.ts @@ -14,9 +14,12 @@ declare module 'react-native-document-picker' { allFiles: '*/*'; audio: 'audio/*'; csv: 'text/csv'; + doc: 'application/msword'; + excel: 'application/vnd.ms-excel'; images: 'image/*'; - plainText: 'text/plain'; pdf: 'application/pdf'; + plainText: 'text/plain'; + powerpoint: 'application/vnd.ms-powerpoint'; video: 'video/*'; zip: 'application/zip'; }; @@ -24,19 +27,26 @@ declare module 'react-native-document-picker' { allFiles: 'public.content'; audio: 'public.audio'; csv: 'public.comma-separated-values-text'; + doc: 'com.microsoft.word.doc'; + excel: 'com.microsoft.excel.xls'; images: 'public.image'; - plainText: 'public.plain-text'; pdf: 'com.adobe.pdf'; + plainText: 'public.plain-text'; + powerpoint: 'com.microsoft.powerpoint.ppt'; video: 'public.movie'; 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'; + 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'; + excel: '.xls .xlsx'; images: '.jpeg .jpg .png'; - plainText: '.txt'; pdf: '.pdf'; + plainText: '.txt'; + powerpoint: '.ppt .pptx'; video: '.mp4'; zip: '.zip .gz'; }; diff --git a/index.js b/index.js index 7e49badc..c6552136 100644 --- a/index.js +++ b/index.js @@ -74,9 +74,12 @@ const Types = { allFiles: '*/*', audio: 'audio/*', csv: 'text/csv', + doc: 'application/msword', + excel: 'application/vnd.ms-excel', images: 'image/*', - plainText: 'text/plain', pdf: 'application/pdf', + plainText: 'text/plain', + powerpoint: 'application/vnd.ms-powerpoint', video: 'video/*', zip: 'application/zip', }, @@ -84,9 +87,12 @@ const Types = { allFiles: 'public.content', audio: 'public.audio', csv: 'public.comma-separated-values-text', + doc: 'com.microsoft.word.doc', + excel: 'com.microsoft.excel.xls', images: 'public.image', - plainText: 'public.plain-text', pdf: 'com.adobe.pdf', + plainText: 'public.plain-text', + powerpoint: 'com.microsoft.powerpoint.ppt', video: 'public.movie', zip: 'public.zip-archive', }, @@ -95,9 +101,12 @@ const Types = { 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', + excel: '.xls .xlsx', images: '.jpeg .jpg .png', - plainText: '.txt', pdf: '.pdf', + plainText: '.txt', + powerpoint: '.ppt .pptx', video: '.mp4', zip: '.zip .gz', }, From 352a5476d3b3b0803e58fb00a9096e66239d4678 Mon Sep 17 00:00:00 2001 From: Luiz Philippe Date: Fri, 25 Sep 2020 11:19:15 -0300 Subject: [PATCH 2/3] Update syntax to match lint patterns --- index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index ad2573fa..38946d4d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -38,8 +38,7 @@ declare module 'react-native-document-picker' { }; 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'; + 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'; excel: '.xls .xlsx'; From 717fae0491f3b6298a66c0a4f58cb228bc264acd Mon Sep 17 00:00:00 2001 From: Luiz Philippe Date: Wed, 7 Oct 2020 19:01:36 -0300 Subject: [PATCH 3/3] Specified OpenXML formats --- index.d.ts | 23 ++++++++++++++++------- index.js | 23 ++++++++++++++++------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/index.d.ts b/index.d.ts index 38946d4d..4aba233b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -15,12 +15,15 @@ declare module 'react-native-document-picker' { audio: 'audio/*'; csv: 'text/csv'; doc: 'application/msword'; - excel: 'application/vnd.ms-excel'; + docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; images: 'image/*'; pdf: 'application/pdf'; plainText: 'text/plain'; - powerpoint: 'application/vnd.ms-powerpoint'; + 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: { @@ -28,25 +31,31 @@ declare module 'react-native-document-picker' { audio: 'public.audio'; csv: 'public.comma-separated-values-text'; doc: 'com.microsoft.word.doc'; - excel: 'com.microsoft.excel.xls'; + docx: 'org.openxmlformats.wordprocessingml.document'; images: 'public.image'; pdf: 'com.adobe.pdf'; plainText: 'public.plain-text'; - powerpoint: 'com.microsoft.powerpoint.ppt'; + 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'; - excel: '.xls .xlsx'; + doc: '.doc'; + docx: '.docx'; images: '.jpeg .jpg .png'; pdf: '.pdf'; plainText: '.txt'; - powerpoint: '.ppt .pptx'; + ppt: '.ppt'; + pptx: '.pptx'; video: '.mp4'; + xls: '.xls'; + xlsx: '.xlsx'; zip: '.zip .gz'; }; }; diff --git a/index.js b/index.js index c6552136..a1ba2cca 100644 --- a/index.js +++ b/index.js @@ -75,12 +75,15 @@ const Types = { audio: 'audio/*', csv: 'text/csv', doc: 'application/msword', - excel: 'application/vnd.ms-excel', + docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', images: 'image/*', pdf: 'application/pdf', plainText: 'text/plain', - powerpoint: 'application/vnd.ms-powerpoint', + 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: { @@ -88,12 +91,15 @@ const Types = { audio: 'public.audio', csv: 'public.comma-separated-values-text', doc: 'com.microsoft.word.doc', - excel: 'com.microsoft.excel.xls', + docx: 'org.openxmlformats.wordprocessingml.document', images: 'public.image', pdf: 'com.adobe.pdf', plainText: 'public.plain-text', - powerpoint: 'com.microsoft.powerpoint.ppt', + 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: { @@ -101,13 +107,16 @@ const Types = { 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', - excel: '.xls .xlsx', + doc: '.doc', + docx: '.docx', images: '.jpeg .jpg .png', pdf: '.pdf', plainText: '.txt', - powerpoint: '.ppt .pptx', + ppt: '.ppt', + pptx: '.pptx', video: '.mp4', + xls: '.xls', + xlsx: '.xlsx', zip: '.zip .gz', }, };