question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to set the type array for extensions

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
franjorubcommented, Sep 30, 2019

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
2reactions
imbudhirajacommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I extend typed Arrays in Swift? - Stack Overflow
For extending typed arrays with classes, the below works for me (Swift 2.2). For example, sorting a typed array:
Read more >
Extension to Array<Element>?… | Apple Developer Forums
Is it possible to extend the swift native Array struct? There's no method on Array to sort by an NSSortDescriptor (bug 27723091 -...
Read more >
Extending arrays for specific element types - Using Swift
I'm extending Array for a custom Element type to add a mutating function. However, I find myself unable to use the function, even...
Read more >
Swift Extensions -Part Three: Type-Constrained Array ...
In this post, we'll explore a way to constrain Array extensions to apply only when the contained type is a certain class or...
Read more >
ES6 Array Extensions in Depth - Ponyfoo
If you aren't the “install things on my computer” kind of human, you might prefer to hop on CodePen and then click on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found