Socket
Socket
Sign inDemoInstall

react-native-android-document-picker

Package Overview
Dependencies
518
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-android-document-picker

React Native Document Picker for Android


Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Install size
515 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 16 Mar 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc