ggunti / react-native-amazing-cropper

Image cropper for react native using Animated API
MIT License
145 stars 83 forks source link

rotateImage of undefined #20

Closed Delevarius closed 4 years ago

Delevarius commented 4 years ago

Everything seems to work fine untill I click the done button, and i get this error message

ExceptionsManager.js:74 Cannot read property 'rotateImage' of undefined

Which is funny, because the rotate button works just fine

ggunti commented 4 years ago

Maybe you forgot the react-native link react-native-image-rotate @react-native-community/image-editor or pod install (in case of rn >= 0.60) step from installation. If you made this step and still not work, please let me know which version of react-native you use and which platform (android or iOS).

Delevarius commented 4 years ago

I did this and it said they are already linked , but the error persists.

I am running react native 0.59.9 currently

ggunti commented 4 years ago

I understand. Please show me your code and let me know on which platform you get the described error.

Delevarius commented 4 years ago

I am just trying to handle the example. The rotation button works great I just want to see the done function

import React, { Component } from 'react';
import AmazingCropper, { DefaultFooter } from 'react-native-amazing-cropper';

class ImageCropper extends Component {
  onDone = (croppedImageUri) => {
    console.log('croppedImageUri = ', croppedImageUri);
    // send image to server for example
  }

  onCancel = () => {
    console.log('Cancel button was pressed');
    // navigate back
  }

  render() {
    return (
      <AmazingCropper
        // Pass custom text to the default footer
        footerComponent={<DefaultFooter doneText='OK' rotateText='ROT' cancelText='BACK' />}
        onDone={this.onDone}
        onCancel={this.onCancel}
        imageUri='https://www.lifeofpix.com/wp-content/uploads/2018/09/manhattan_-11-1600x2396.jpg'
        imageWidth={1600}
        imageHeight={2396}
      />
    );
  }

Just as I click the done button, I get this error error

ggunti commented 4 years ago

You said that you get Cannot read property 'rotateImage' of undefined error

Delevarius commented 4 years ago

Apologies, wrong screenshot here is the correct one

ErrorCrop

ggunti commented 4 years ago

The problem is that react-native-image-rotate is not linked. I recommend you to check again STEPS TO INSTALL section inside documentation and try to do each step again. Do them step by step (order is important).