Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Expo.DocumentPicker.getDocumentAsync properly. [Expo] [ReactNative]

I've tried to restrict file types that can be selected by Expo.DocumentPicker.getDocumentAsync, but without success.

How to filter many mimeTypes at once?

I already tried as follow:

Expo.DocumentPicker.getDocumentAsync({type: "image/*;application/pdf"});

and

Expo.DocumentPicker.getDocumentAsync({type: "image/*,application/pdf"});

and

Expo.DocumentPicker.getDocumentAsync({type: ["image/*","application/pdf"]}); //CRASH

I'm using sdk 27.0.0.

Some suggestion? Expo team? :}

Reference: https://docs.expo.io/versions/latest/sdk/document-picker#type-string----the-mime-type-of

like image 568
rodrix Avatar asked Aug 15 '26 11:08

rodrix


1 Answers

expo-document-picker now accepts an array of MIME types like

 getDocumentAsync({type: ["image/*","application/pdf"]});

Refer: this documentaiton

like image 131
Prabhat Choudhary Avatar answered Aug 18 '26 03:08

Prabhat Choudhary