react-native-documents / document-picker

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

The pick Promise is not resolving to an array of objects, instead it resolves an object alone. #592

Closed Md-Mudassir47 closed 2 years ago

Md-Mudassir47 commented 2 years ago

Bug report

Summary

As per the docs it says The pick Promise resolves to an array of objects but while testing it its resolving only to an object.

Reproducible sample code

    const fileData = await DocumentPicker.pick({
      // Allowing only expected files

      type: [DocumentPicker.types.allFiles],
    });

    console.log(
      '🚀 ~ file: resume.js ~ line 83 ~ onUpload ~ pickedFile',
      pickedFile,
    );
    /* pickedFile {"fileCopyUri": "content://com.android.providers.media.documents/document/document%3A26849", "name": "VAMSI RESUME.pdf", "size": 128365, "type": "application/pdf", "uri": "content://com.android.providers.media.documents/document/document%3A26849"}*/ 

Environment info

System:
    OS: macOS 12.5.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 112.92 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 8.18.0 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8815526
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 15.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: ^0.67.4 => 0.67.4 
    react-native-macos: Not Found

library version: "react-native-document-picker": "^5.2.0"

iOS / Android version: 15/12

vonovak commented 2 years ago

Hello and thanks for reporting, the problem is that you're using version 5, the docs are for latest version - v8. Thank you 🙂