Socket
Socket
Sign inDemoInstall

expo-crop-image

Package Overview
Dependencies
805
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

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).


Version published
Weekly downloads
93
increased by10.71%
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 03 Dec 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc