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

how to set the type array for extensions #240

Closed
franjorub opened this issue Sep 6, 2019 · 10 comments
Closed

how to set the type array for extensions #240

franjorub opened this issue Sep 6, 2019 · 10 comments

Comments

@franjorub
Copy link

franjorub commented Sep 6, 2019

I'm trying filter only for typical docs extensions:

 type: [
          '.pdf',
          '.docx', 
          'com.microsoft.word.docx', 
          'application/docx', 
          'com.microsoft.excel.xlsx', 
          'application/xlsx', 
          '.xlsx'
        ],

but I can't select them
imagen

@franjorub franjorub changed the title how to put the array type for extensions how to set the array type for extensions Sep 6, 2019
@franjorub
Copy link
Author

I try too
type: [ ".docx application/docx com.microsoft.word.docx", ".doc application/doc com.microsoft.word.doc", ".xlsx application/xlsx com.microsoft.excel.xlsx", ".xls application/xls com.microsoft.excel.xls", DocumentPicker.types.pdf, ],

@franjorub franjorub changed the title how to set the array type for extensions how to set the type array for extensions Sep 6, 2019
@imbudhiraja
Copy link

same issue. @franjorub Did you find any solution ?

@franjorub
Copy link
Author

@imbudhiraja yes I use react-native-mime-types and Every lookup función as array position

@douglas-cavalcante
Copy link

same issue. @franjorub Did you find any solution ? Example, please !!!

@imbudhiraja
Copy link

@franjorub can you please share a working example.

@imbudhiraja
Copy link

imbudhiraja commented Sep 30, 2019

@franjorub I'm using this right now. but its not working. I'm using v3.2.4

const types = [
            DocumentPicker.types.pdf,
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'application/vnd.ms-powerpoint',
            'application/vnd.openxmlformats-officedocument.presentationml.presentation',
            'application/vnd.oasis.opendocument.text',
          ];

@imbudhiraja
Copy link

imbudhiraja commented Sep 30, 2019

@douglas-cavalcante working code for .docx, .pptx, .xlsx, .pdfs.


const iosTypes = [
  'org.openxmlformats.wordprocessingml.document',
  'com.adobe.pdf',
  'org.openxmlformats.spreadsheetml.sheet',
  'org.openxmlformats.presentationml.presentation',
];

const androidTypes = [
  'application/msword',
  'application/pdf',
  'application/vnd.ms-excel',
  'application/vnd.ms-powerpoint',
];

Hope this works for you as well.

@franjorub
Copy link
Author

Hi guys, sorry the late, this is how I was solved the issue

  1. You need install react-native-mime-types
  2. This is how I set the array:
    type: [ mime.lookup('docx'), mime.lookup('xlsx'), mime.lookup('doc'), mime.lookup('xls'), ],
    And works perfect

@saggiyogesh
Copy link

2. type: [ mime.lookup('docx'), mime.lookup('xlsx'), mime.lookup('doc'), mime.lookup('xls'), ],

this will not work on iOS. Correct iOS type will be (as mentioned by @imbudhiraja )

const iosTypes = [
  'org.openxmlformats.wordprocessingml.document',
  'com.adobe.pdf',
  'org.openxmlformats.spreadsheetml.sheet',
  'org.openxmlformats.presentationml.presentation',
];

@vonovak
Copy link
Collaborator

vonovak commented Apr 17, 2020

#240 (comment) seems to be the correct way to do this, closing as answered.

@vonovak vonovak closed this as completed Apr 17, 2020
@react-native-documents react-native-documents locked and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants