Skip to content

lokdevp/react-native-directory-picker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-directory-picker

A React Native module that allows you to use native UI to select a directory from the device library

⚠️ Using this component is not recommended. This is a workaround.

Install

Android

$ npm install git+https://github.com/lokdevp/react-native-directory-picker.git
$ react-native link
<!-- file: android/src/main/AndroidManifest.xml -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myApp">
    <!-- add following permissions -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <!-- -->
    ...

Usage

  1. In your React Native javascript code, bring in the native module:
import DirectoryPickerManager from 'react-native-directory-picker';
  1. Use it like so:

When you want to display the picker:

DirectoryPickerManager.showDirectoryPicker(null, (response) => {
  console.log('Response = ', response);

  if (response.didCancel) {
    console.log('User cancelled directory picker');
  }
  else if (response.error) {
    console.log('DirectoryPickerManager Error: ', response.error);
  }
  else {
    this.setState({
      directory: response
    });
  }
});

News

Compatible with Android X

Compatible with all versions of RN

Compatible with files from Google Drive

Requesting permission if not exist

Retrieving fileName and file type

About

Directory Picker for React Native

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 94.5%
  • JavaScript 5.5%