README
react-native-bj-image-croping
Getting started
$ npm install react-native-bj-image-croping --save
Mostly automatic installation
$ react-native link react-native-bj-image-croping
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-bj-image-croping
and addRNBJImageCroping.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNBJImageCroping.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Usage
import RNBJImageCroping from 'react-native-bj-image-croping';
// TODO: What to do with the module?
RNBJImageCroping;
Option
interface Options {
type?: 'camera' | 'library';
aspectRatio?: 'AspectRatioSquare'
| 'AspectRatio3x2'
| 'AspectRatio5x3'
| 'AspectRatio4x3'
| 'AspectRatio5x4'
| 'AspectRatio7x5'
| 'AspectRatio16x9';
isCropping?: boolean; // Enable crop or no
}
Crop the image with aspect ratio
RNBJImageCroping.openImagePicker({
type: 'library',
aspectRatio: 'AspectRatio4x3',
isCropping: true
}).then(image => {
// TODO:
// Image is saved in NSTemporaryDirectory!
// image = {uri, width, height}
}, error => console.log(error))