React Native Image Picker
A React Native module that allows you to use native UI to select a photo/video from the device library or directly from the camera, like so:
Before you open an issue
This library started as a basic bridge of the native iOS image picker, and I want to keep it that way. As such, functionality beyond what the native
UIImagePickerController supports will not be supported here. Multiple image selection, more control over the crop tool, and landscape support are things missing from the native iOS functionality - not issues with my library. If you need these things, react-native-image-crop-picker might be a better choice for you.
yarn add react-native-image-picker react-native link react-native-image-picker
You will also need to add
UsageDescription on iOS and some permissions on Android, refer to the Install doc.
;// More info on all the options is below in the API Reference... just some common use cases shown hereconst options =title: 'Select Avatar'customButtons: name: 'fb' title: 'Choose Photo from Facebook'storageOptions:skipBackup: truepath: 'images';/*** The first arg is the options object for customization (it can also be null or omitted for default options),* The second arg is the callback which sends object: response (more info in the API Reference)*/ImagePicker;
Then later, if you want to display this image in your render() method:
<Image source=thisstateavatarSource style=stylesuploadAvatar />
Directly Launching the Camera or Image Library
To Launch the Camera or Image Library directly (skipping the alert dialog) you can do the following:
// Launch Camera:ImagePicker;// Open Image Library:ImagePicker;
On iOS, don't assume that the absolute uri returned will persist. See #107
For more, read the API Reference.