1.0.7 • Published 3 years ago

react-native-android-document-picker v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-android-document-picker

Note: This library is Android specific.

Getting started

$ npm install react-native-android-document-picker --save

Mostly automatic installation

$ react-native link react-native-android-document-picker

Usage

import AndroidDocumentPicker from 'react-native-android-document-picker';

openDocument

AndroidDocumentPicker.openDocument({
    multipleFiles: boolean,
    fileTypes: object,
  },
  successCallback: Function,
  failureCallback: Function
);

openDocument usage

const handleChoosePhotoAndroid = async () => {
    let newFiles = [...files];

        await AndroidDocumentPicker.openDocument({multipleFiles: true, fileTypes: ["image/*"]}, (array) => {
          array.forEach((el) => {
            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"}
            
            newFiles.push({
            fileName: doc.fileName,
            uri: doc.fileUri,
            type: doc.fileType,
            size: doc.fileSize
            });
          });

          setFiles(newFiles);
        }, 
        (error) => {
            console.log('error', error);
        });

To-do

  • clean up iOS related folders
  • improve documentation
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago