0.2.4 • Published 10 months ago

react-native-pure-photo-crop v0.2.4

Weekly downloads
3
License
MIT
Repository
github
Last release
10 months ago

react-native-pure-photo-crop

This is a module which help you crop an image.

Installation

npm i react-native-pure-photo-crop
// link below 0.60
react-native link react-native-pure-photo-crop

Setup

iOS

Modify AppDelegate.m

#import <RNTPhotoCrop.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  [RNTPhotoCrop init:^(NSString *url, void (^ onComplete)(UIImage *)) {
    // add your image loader here
  }];

  return YES;
}

Android

Add jitpack in your android/build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Modify MainApplication

class MainApplication : Application(), ReactApplication {

  override fun onCreate() {
    super.onCreate()

    RNTPhotoCropModule.init { context, url, onComplete ->

        // load image by url
        // onComplete.invoke(null): load error
        // onComplete.invoke(bitmap): load success

    }

  }

}

Usage

import photoCrop from 'react-native-pure-photo-crop'

// At first, make sure you have the permissions.
// ios: nothing
// android: WRITE_EXTERNAL_STORAGE

// If you don't have these permissions, you can't call open method.

photoCrop.open({
  url: 'image url or file path',
  width: 300,
  height: 200,
  // optional
  guideLabelTitle: '',
  // optional
  cancelButtonTitle: '取消',
  // optional
  resetButtonTitle: '重置',
  // optional
  submitButtonTitle: '确定'
})
.then(file => {
  let { path, size, width, height } = file

})
.catch(error => {
  // click cancel button
})
0.2.4

10 months ago

0.2.3

1 year ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago