rn-file-picker-android
v1.0.4
Published
React Native Document Picker for Android
Downloads
4
Maintainers
Readme
rn-file-picker-android
Note: This library is Android specific.
Getting started
$ npm install rn-file-picker-android --save
Mostly automatic installation
$ react-native link rn-file-picker-android
Usage
import AndroidDocumentPicker from 'rn-file-picker-android';
openDocument
AndroidDocumentPicker.openDocument({
multipleFiles: boolean,
fileTypes: object,
},
successCallback: Function,
failureCallback: Function
);
openDocument usage
const handleChoosePhotoAndroid = async () => {
await AndroidDocumentPicker.openDocument({multipleFiles: false, fileTypes: ["application/pdf", "image/*"]},
(documents: any) => {
documents.forEach((el: any) => {
const doc = JSON.parse(el);
console.log("doc:", doc);
// {"fileName": "some_pdf_file.pdf",
// "fileSize": "450110",
// "fileType": "application/pdf",
// "fileUri": "content://com.android.providers.downloads.documents/document/1058"}
documentsAux.push({
fileName: doc.fileName,
uri: doc.fileUri,
type: doc.fileType,
});
});
},
(error: any) => {
console.log('error', error);
});
To-do
- [x] clean up iOS related folders
- [ ] improve documentation