From bc47172184e8acce5197d6d345a3d06f33805470 Mon Sep 17 00:00:00 2001 From: Matih Abbas Date: Tue, 19 Sep 2017 00:26:13 -0400 Subject: [PATCH 1/3] Pass filePath props --- src/ImageCrop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageCrop.js b/src/ImageCrop.js index cf5b0af..ea9808d 100644 --- a/src/ImageCrop.js +++ b/src/ImageCrop.js @@ -191,7 +191,7 @@ class ImageCrop extends Component { ) } crop(){ - return this.refs.cropit.captureFrame({quality: this.props.quality, type: this.props.type, format: this.props.format}) + return this.refs.cropit.captureFrame({quality: this.props.quality, type: this.props.type, format: this.props.format, filePath: this.props.filePath}) } } ImageCrop.defaultProps = { From acc0858d276063ae7b825e8b8312361fde7e2475 Mon Sep 17 00:00:00 2001 From: Matih Abbas Date: Tue, 19 Sep 2017 11:53:27 -0400 Subject: [PATCH 2/3] Add filepath propType and default values --- src/ImageCrop.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ImageCrop.js b/src/ImageCrop.js index ea9808d..0238d65 100644 --- a/src/ImageCrop.js +++ b/src/ImageCrop.js @@ -205,6 +205,7 @@ ImageCrop.defaultProps = { pixelRatio: PixelRatio.get(), type: 'jpg', format: 'base64', + filePath: '' } ImageCrop.propTypes = { image: React.PropTypes.string.isRequired, @@ -217,5 +218,6 @@ ImageCrop.propTypes = { pixelRatio: React.PropTypes.number, type: React.PropTypes.string, format: React.PropTypes.string, + filePath: React.PropTypes.string } module.exports=ImageCrop From e051e1373256613f9fd7df68c7c01c0ba7a52526 Mon Sep 17 00:00:00 2001 From: Matih Abbas Date: Wed, 20 Sep 2017 11:18:51 -0400 Subject: [PATCH 3/3] Update documentation --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ce458bd..7b91015 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ yarn add react-native-image-cropper - `pinchToZoom` Use pinch to zoom image? (default: true) - `quality`: a value from 0 to 1 to describe the quality of the snapshot. 0 means 0% (most compressed) and 1 means 100% (best quality). (default: 1) - `type`: the file type default value is **"png"**, **"jpg"** is also supported. Refer to implementations to see more supported values. (default: jpg) +- `format`: the format of the output. Supported values: **"base64"**, **"file"**. (default: base64) +- `filePath`: if format is **"file"**, the path to write the image to (default: "") - `pixelRatio`: the pixel ratio to use for the rendering. By default the screen pixel scale will be used. #### `{ImageCrop}` Functions