react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.35k stars 441 forks source link

Multiple types doesn't work on android #513

Closed LaGregance closed 2 years ago

LaGregance commented 2 years ago

Bug report

Summary

When I set an array of string for type, I can select any file type on Android.

Reproducible sample code

// 1. Work, I can select only images
DocumentPicker.pick({
        allowMultiSelection: false,
        copyTo: 'cachesDirectory',
        type: DocumentPicker.types.images,
});

// 2. Not work, I can select any type of file (Android only, work well on iOS)
DocumentPicker.pick({
        allowMultiSelection: false,
        copyTo: 'cachesDirectory',
        type: [DocumentPicker.types.images, DocumentPicker.types.pdf],
});

Steps to reproduce

Just call the function DocumentPicker.pick with multiple types

Environment info

npx react-native info output:

info Fetching system and libraries information...
System:
    OS: macOS 11.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Memory: 75.16 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.6 - /usr/local/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
    Watchman: 2021.11.15.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 28, 29, 30, 31
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 31.0.0
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7678000
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.12 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.66.0 => 0.66.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

library version: 7.1.2 Android version: 11

ZohaibAhmad786 commented 2 years ago

Same here.

digitalbore commented 2 years ago

I have the same problem.

With the following code, I can select any file type

const pickerResult = await DocumentPicker.pickMultiple({
      type: [DocumentPicker.types.pdf],
    });

"react-native-document-picker": "^8.0.0", Android 11

fabio-C commented 2 years ago

Any update?

vonovak commented 2 years ago

I'm going to close this because I believe it was fixed in #557. Please open a new issue if problem persists. Thank you :)