callstack / react-native-image-editor

A library providing an API for cropping images from the web and the local file system.
MIT License
378 stars 118 forks source link

Add support a 'contain' resize mode for Android #78

Closed retyui closed 10 months ago

retyui commented 4 years ago

This PR adds breaking changes!

Test Plan

demo gif

1) Install:

npx react-native init testEditor
cd testEditor
yarn add retyui/react-native-image-editor#android-contain-resize-mode

2) Paste code from example/App.js

3) Extends crop data

const cropData: ImageCropData = {
  offset: {
    x: this.props.image.width * offsetRatioX,
    y: this.props.image.height * offsetRatioY,
  },
  size: {
    width: this.props.image.width * sizeRatioX,
    height: this.props.image.height * sizeRatioY,
  },
+  resizeMode: 'contain',
+  displaySize: {
+    width: 2000,
+    height: 1000,
+  },
};

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
Android

Checklist

EvanBacon commented 2 years ago

I apologize but I'm not familiar with this package.