react-native-image-chooser
A React Native module to show system Image chooser. Currently only supports Android.
Installation
npm i --save react-native-image-chooser
Add it to your android project
In android/settings.gradle
... include ':react-native-image-chooser'project(':react-native-image-chooser').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-chooser/android')
In android/app/build.gradle
... dependencies { ... compile project(':react-native-image-chooser')}
Register module (in MainActivity.java
)
// <--- import
Usage
First import the module as follows:
;
To show the chooser, call the pickImage
method:
try const data = await ImageChooser; // do something with the data catch err // handle error
The pickImage
method returns a Promise
with data. The data object has the following properties:
height: number;width: number;size: number;name: string;uri: string;