npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-crop

v0.1.0

Published

A React Native module to crop images with a native crop editor UI on iOS and Android

Readme

rn-crop

A React Native module that opens a native crop editor over an existing image and returns the cropped result — TOCropViewController on iOS, android-image-cropper on Android.

npm downloads npm package License

Requirements

| | Minimum | | --- | --- | | iOS | 15.1 — React Native's own minimum | | Android | API 24 (minSdkVersion, overridable from your root project) |

Installation

yarn add rn-crop

iOS

npx pod-install

No further setup is required — the crop editor works out of the box on both platforms.

Usage

import { openCropper } from 'rn-crop';

try {
  const image = await openCropper({
    path: 'file:///path/to/photo.jpg', // also accepts content://, ph://, and http(s):// sources
    aspectRatio: { width: 1, height: 1 }, // omit for freeform cropping
    width: 1000, // downscale the output to fit this box, preserving aspect ratio
    height: 1000,
    quality: 0.9,
  });

  console.log(image.uri, image.width, image.height);
} catch (error) {
  if (error.code === 'E_CROP_CANCELLED') {
    // user backed out of the crop editor
  } else {
    // error.code === 'E_CROP_ERROR'
  }
}

API

openCropper(options): Promise<CropResult>

options

| Key | Type | Description | | --- | --- | --- | | path | string | Required. Local file path, content:///ph:// asset URI, or a remote http(s):// URL of the image to crop. | | aspectRatio | {width: number, height: number} | Locks the crop box to this ratio, e.g. {width: 16, height: 9}. Omit for freeform cropping. | | width | number | Bounding box the cropped output is downscaled to fit, preserving aspect ratio. Never upscales. | | height | number | See width. | | quality | number | JPEG compression quality from 0 to 1. Defaults to 1. | | includeBase64 | boolean | Also returns the cropped image as a base64 string. Defaults to false. | | cropperToolbarTitle | string | Title shown in the crop editor's toolbar. Android only. |

CropResult

| Key | Type | Description | | --- | --- | --- | | uri | string | file:// URI of the cropped image. | | width | number | Width of the cropped image, in pixels. | | height | number | Height of the cropped image, in pixels. | | fileSize | number | Size of the cropped image, in bytes. | | fileName | string | Generated file name of the cropped image. | | mime | string | MIME type of the cropped image, e.g. image/jpeg. | | base64 | string? | Present when includeBase64 is true. |

Errors

The returned promise rejects with an Error whose .code is one of:

  • E_CROP_CANCELLED — the user dismissed the crop editor without confirming.
  • E_CROP_ERROR — any other failure (bad input, decode failure, I/O error).

Contributing

License

MIT


Made with create-react-native-library