You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

expo-crop-image

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-crop-image

Allows user to crop image with given aspect ratio for react native using expo on Android and IOS - (Workaround for IOS always square images).

0.2.1
latest
Source
npmnpm
Version published
Weekly downloads
312
27.35%
Maintainers
1
Weekly downloads
 
Created
Source

preview image

License Forks Stars

Expo crop image

Allows user to crop image with given aspect ratio for react native using expo on Android and IOS.


preview image             preview image             preview image            

🚀 How to install

npm install expo-crop-image

ImageEditor

isRequired if there is a * in the name field

nameProptypesDescription
imageUri *stringImage address that will be used for cropping
fixedAspectRatio *numberExpect => aspect ratio.
minimumCropDimensions(size)Expect => {width: number, height: number} [Default 100 X 100].
onEditingCancel *funcvoid
onEditingComplete *funcReturns image object (image object fields => uri, width, height).
editorOptionsobjectCustomize appearance of editor
processingComponentReactNodeCustomize appearance of loading between process

Example

import { ImageEditor } from "expo-crop-image";

<ImageEditor
  imageUri={uri}
  fixedAspectRatio={2 / 3}
  minimumCropDimensions={{
    width: 50,
    height: 50,
  }}
  onEditingCancel={() => {
    console.log("onEditingCancel");
  }}
  onEditingComplete={(image) => {
    console.log(image);
  }}
/>;

Editor Options

import { ImageEditor } from "expo-crop-image";

<ImageEditor
  ...
  editorOptions={{
    ...
  }}
/>;

type EditorOptions = {
  backgroundColor?: string
  controlBar?: {
    position?: 'top' | 'bottom'
    backgroundColor?: string
    height?: number
    cancelButton?: IconProps
    cropButton?: IconProps
    backButton?: IconProps
    saveButton?: IconProps
  }
  coverMarker?: {
    show?: boolean
    color?: string
  }
  gridOverlayColor?: string
  overlayCropColor?: string
}

type IconProps = {
  color: string
  text: string
  iconName: FeatherIconNames | MaterialIconNames
}

🧪 Technologies

This project was developed using the following technologies:

  • ReactNative
  • Expo
  • Recoil
  • Typescript

📌 Requirements

To use this package you have to install the following dependencies

🚀 How to run locally

Clone the project and access the folder.

git clone https://github.com/NitoBa/expo-crop-image.git

cd expo-crop-image && npm install
cd example-app && npm install && cd ..

Compile the package locally

# build the package locally
npm run build:dev
# watch to changes while running with app
npm run build:watch

📝 License

This project is licensed under the MIT License. See the LICENSE file for details.

Made with 💜 by Bruno Alves 👋

Keywords

expo-crop-image

FAQs

Package last updated on 03 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts