🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-native-android-document-picker

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-android-document-picker

React Native Document Picker for Android

1.0.7
latest
Source
npm
Version published
Maintainers
1
Created
Source

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

Keywords

react-native

FAQs

Package last updated on 16 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts