Home

Awesome

react-native-full-image-picker

npm version Build Status

中文说明

It is a react native UI component including a camera view and an album selection view. You can take photos, take video recording or select photo from photo library.

It supports:

ScreenShots

<p float="left"> <img src="/resource/camera.gif" width="25%"> <img src="/resource/album.gif" width="25%"> </p>

Same UI on Android.

Install

Install by Yarn:

yarn add react-native-full-image-picker

Install by NPM:

npm install --save react-native-full-image-picker

NOTICE: This library has no native code for iOS and Android. But you should also install native code of these libraries:

Usage

First import in the file:

import * as ImagePicker from 'react-native-full-image-picker';

It has three method:

options is a object with these settings:

You can use react-native-general-actionsheet to show ActionSheet by same API and UI with ActionSheetIOS.

Change Default Property

You can import page and change defaultProps to modify settings globally:

import * as ImagePicker from 'react-native-full-image-picker';

ImagePicker.XXX.defaultProps.yyy = ...;

The XXX is the export items of library. Following is the detail.

PhotoModalPage

This is the outter navigator for all modes. You can change these properties of defaultProps:

NameTypeDescription
okLabelstringOK button text
cancelLabelstringCancel button text
deleteLabelstringDelete button text
useVideoLabelstringUseVideo button text
usePhotoLabelstringUsePhoto button text
previewLabelstringPreview button text
choosePhotoTitlestringChoosePhoto page title
maxSizeChooseAlert(num: number) => stringMax size limit alert message when choosing photos
maxSizeTakeAlert(num: number) => stringMax size limit alert message when taking photos from camera
supportedOrientationsstring[]Supported orientations. Default is landscape and portrait

CameraView

This is page for taking photos from camera or recording video. You can change these properties of defaultProps:

NameTypeDescription
maxSizenumberDefault max number limit
sideTypeRNCamera.Constants.TypeCamera side type. Default is back
flashModeRNCamera.Constants.FlashModeFlash mode. Default is off

AlbumListView

This is page for selecting photo from photo library. You can change these properties of defaultProps:

NameTypeDescription
maxSizenumberDefault max number limit
autoConvertPathbooleanAuto copy photo or not to convert file path to standard file path. Default is false
assetTypestringAsset type. Please see CameraRoll Docs
groupTypesstringGroup type. Please see CameraRoll Docs