Skip to content

Commit

Permalink
feat(PixelRatio): Added PixelRatio to set pixel density
Browse files Browse the repository at this point in the history
  • Loading branch information
st0ffern committed Jan 26, 2017
1 parent f4148aa commit b26273c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ 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)
- `pixelRatio`: the pixel ratio to use for the rendering. By default the screen pixel scale will be used.

#### `{ImageCrop}` Functions
- `crop()`: returns a base64 encoded image.
Expand Down
5 changes: 4 additions & 1 deletion src/ImageCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react'
import {
View,
Image,
PixelRatio,
PanResponder
} from 'react-native'

Expand Down Expand Up @@ -177,7 +178,7 @@ class ImageCrop extends Component {
render() {
return (
<View {...this._panResponder.panHandlers}>
<Surface width={this.props.cropWidth} height={this.props.cropHeight} ref="cropit">
<Surface width={this.props.cropWidth} height={this.props.cropHeight} pixelRatio={this.props.pixelRatio} ref="cropit">
<GLImage
source={{ uri: this.props.image}}
imageSize={{height: this.state.imageHeight, width: this.state.imageWidth}}
Expand All @@ -201,6 +202,7 @@ ImageCrop.defaultProps = {
minZoom: 0,
maxZoom: 100,
quality: 1,
pixelRatio: PixelRatio.get(),
type: 'jpg',
format: 'base64',
}
Expand All @@ -212,6 +214,7 @@ ImageCrop.propTypes = {
maxZoom: React.PropTypes.number,
minZoom: React.PropTypes.number,
quality: React.PropTypes.number,
pixelRatio: React.PropTypes.number,
type: React.PropTypes.string,
format: React.PropTypes.string,
}
Expand Down

0 comments on commit b26273c

Please sign in to comment.