0.0.5 • Published 5 years ago

rn-image-crop v0.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

React Native Image Crop

This is a simple library for pompting the user to crop an image. The interface is interactive and allows dragging / resizing of the crop window.

Note: still in development, theming is in progress

Snack Example

Installation

yarn add rn-image-crop

Usage

Include the component

import ImageCrop from "rn-image-crop";

Place it in your view

// see /example folder
<ImageCrop  
  open={showImageCrop}  
  image={Image.resolveAssetSource(imageToCrop)}  
  onClose={() => setShowImageCrop(false)}  
  onCropImage={(image) => {  
      setCroppedImage(image)  
      setShowImageCrop(false)  
  }}  
/>
  • This will present a modal to the user when open is set to true and will display whatever image is passed along to image
  • Note: if you are loading an image from disk and not the network, you must wrap the image like Image.resolveAssetSource(image)

Props

PropDefaultTypeDescription
openfalsebooleanWhether or not the modal should be open.
imagenullimageMust be an actual image or a URI. If loaded from disk, wrap in Image.resolveAssetSource(image)
onClosefuncFunction triggered when user presses the Cancel button.
onCropImagefuncFunction triggered when user presses the Crop button.(image, crop: {originX, originY, width, height}) => {}

|

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago