react-native-documents/document-picker

[IOS] Can't pick markdown file

Closed this issue · 2 comments

Question

Hi all,
I can't choose only type file .md in IOS.

Here is my code:

const pickerResult = await DocumentPicker.pickSingle({
        presentationStyle: 'fullScreen',
        type: [
          'com.drav.bio.md',
          'text/x-markdown',
          'text/markdown',
        ],
        copyTo: 'cachesDirectory',
      });
      
setResultFile(pickerResult);

And I add the defining file and data types in the Info.plist

<key>CFBundleDocumentTypes</key>
 <array>
  <dict>
   <key>CFBundleTypeName</key>
   <string>Markdown File</string>
   <key>CFBundleTypeRole</key>
   <string>Editor</string>
   <key>LSHandlerRank</key>
   <string>Owner</string>
   <key>LSItemContentTypes</key>
   <array>
    <string>com.drav.bio.md</string>
   </array>
  </dict>
 </array>
 <key>LSSupportsOpeningDocumentsInPlace</key>
 <true/>
 <key>UTExportedTypeDeclarations</key>
 <array>
  <dict>
   <key>UTTypeConformsTo</key>
   <array>
    <string>public.content</string>
    <string>public.data</string>
   </array>
   <key>UTTypeDescription</key>
   <string>Markdown File</string>
   <key>UTTypeIdentifier</key>
   <string>com.drav.bio.md</string>
   <key>UTTypeTagSpecification</key>
   <dict>
    <key>public.filename-extension</key>
    <array>
     <string>md</string>
    </array>
    <key>public.mime-type</key>
    <array>
     <string>text/x-markdown</string>
    </array>
   </dict>
  </dict>
 </array>

Can someone help me :(
Thank you!

Hello and thanks for asking,
this should help: https://daringfireball.net/linked/2011/08/05/markdown-uti
Thank you 🙂

Thank you!