Giter Club home page Giter Club logo

react-native-customized-image-picker's Introduction

react-native-customized-image-picker

iOS/Android image picker with support for camera, video compression, multiple images and cropping

Result

Usage

use version

version >= 0.0.20

Import library

import ImagePicker from 'react-native-customized-image-picker';

Select from gallery

Call single image picker

ImagePicker.openPicker({
  
}).then(image => {
  console.log(image);
});

Call multiple image picker

ImagePicker.openPicker({
  multiple: true
}).then(images => {
  console.log(images);
});

Request Object

Property Type Description
cropping bool (default false) Enable or disable cropping
width number(default 200) Width of result image when used with cropping option
height number(default 200) Height of result image when used with cropping option
multiple bool (default false) Enable or disable multiple image selection
isCamera bool (default false) Enable or disable camera selection
openCameraOnStart bool (default false) Enable or disable turn on the camera when it starts
returnAfterShot bool (default false) Enable or disable pictures taken directly
maxSize number (default 9) set image count
includeBase64 bool (default false) Enable or disable includeBase64
compressQuality number([0-100]) Picture compression ratio
title string Sets the title of the page

Response Object

Property Type Description
path string Selected image location
width number Selected image width
height number Selected image height
mime string Selected image MIME type (image/jpeg, image/png)
size number Selected image size in bytes
data base64 Optional base64 selected file representation

Install

npm i react-native-customized-image-picker --save
react-native link react-native-customized-image-picker

Post-install steps

iOS

native for ios not modified; please see : https://github.com/ivpusic/react-native-image-crop-picker

In Xcode open Info.plist and add string key NSPhotoLibraryUsageDescription with value that describes why do you need access to user photos. More info here https://forums.developer.apple.com/thread/62229. Depending on what features you use, you also may need NSCameraUsageDescription and NSMicrophoneUsageDescription keys.

cocoapods users
  • Add platform :ios, '8.0' to Podfile (!important)
  • Add pod 'RSKImageCropper' and pod 'QBImagePickerController' to Podfile
non-cocoapods users
  • Drag and drop the ios/ImageCropPickerSDK folder to your xcode project. (Make sure Copy items if needed IS ticked)
  • Click on project General tab
    • Under Deployment Info set Deployment Target to 8.0
    • Under Embedded Binaries click + and add RSKImageCropper.framework and QBImagePicker.framework

How it works?

It is basically wrapper around few libraries

Android

iOS

  • QBImagePickerController
  • RSKImageCropper

Update log

0.0.29

  • 增加returnAfterShot和title参数
  • 图片选择过滤临时目录

License

MIT

react-native-customized-image-picker's People

Contributors

kmorales13 avatar liukefu2050 avatar

Watchers

 avatar

Forkers

evilchis94

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.