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

Response for single item DocumentPicker.pick is array #512

Closed docdrue closed 2 years ago

docdrue commented 2 years ago

Bug report

Summary

Like i see in documentation for react-native-document-picker await DocumentPicker.pick({ type: [DocumentPicker.types.images],}) return object but in my case it's array with object

Reproducible sample code

// Pick a single file try { const res = await DocumentPicker.pick({ type: [DocumentPicker.types.pdf], }) console.log(res) // [{"fileCopyUri": null, "name": "file.pdf", "size": 23460, "type": "application/pdf", "uri": "file:///Users//file.pdf"}] } catch (err) { console.error(err) }

Environment info

System: OS: macOS 11.6 CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Memory: 1.22 GB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v12.18.0/bin/yarn npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 13.1/13A1030d - /usr/bin/xcodebuild Languages: Java: 15.0.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.2 => 0.64.2 react-native-macos: Not Found

library version: 7.1.2

vonovak commented 2 years ago

hello,

i see in documentation for react-native-document-picker await DocumentPicker.pick({ type: [DocumentPicker.types.images],}) return object

where exactly do you see that?

thanks

docdrue commented 2 years ago

hello,

i see in documentation for react-native-document-picker await DocumentPicker.pick({ type: [DocumentPicker.types.images],}) return object

where exactly do you see that?

thanks

https://www.npmjs.com/package/react-native-document-picker

Screenshot 2021-12-14 at 13 11 31
vonovak commented 2 years ago

thanks for pointing that out; the outdated example was removed πŸ‘