ggunti / react-native-amazing-cropper

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

Android cropping #5

Closed joshwinter closed 5 years ago

joshwinter commented 5 years ago

Hello,

For Android - after the crop is complete, it doesn't seem to be passing the actual cropped portion to the variable like it does in iOS, it's just returning the full image. Any clues as to what the problem may be?

onDone = croppedImageUri => {

Thanks!

Ektasahusahu commented 5 years ago

@joshwinter i just check that we have to pass the given image height and width also than we will get the exact cropped image see...

<AmazingCropper onDone={this.onDone} onCancel={this.onCancel} imageUri={this.state.image.uri} imageWidth={this.state.image.width} imageHeight={this.state.image.height} NOT_SELECTED_AREA_OPACITY={0.3} BORDER_WIDTH={20} />

try this...

joshwinter commented 5 years ago

Okay thanks! I will try now.

joshwinter commented 5 years ago

@Ektasahusahu Unfortunately, I just checked and I'm passing the width and height in the example, but it's still not returning the cropped image in the croppedImageUri variable. We're you able to get it working? If yes, does your code look like this?

<AmazingCropper
        onDone={this.onDone}
        onCancel={this.onCancel}
        imageUri='https://www.lifeofpix.com/wp-content/uploads/2018/09/manhattan_-11-1600x2396.jpg'
        imageWidth={1600}
        imageHeight={2396}
        NOT_SELECTED_AREA_OPACITY={0.3}
        BORDER_WIDTH={20}
      />
joshwinter commented 5 years ago

@ggunti Just wanted to see if you have problems on your end for Android or if I'm doing something wrong.

ggunti commented 5 years ago

I just tested it and seems that it works also on android without any problems. Try to reproduce what I did.

My code:

Captură de ecran din 2019-04-10 la 19 04 27

When we run it:

Captură de ecran din 2019-04-10 la 18 53 10

Press DONE and obtain:

Captură de ecran din 2019-04-10 la 18 53 29

As you can see, the resulted image is the cropped one. I also tested it on real device and it worked.

joshwinter commented 5 years ago

Wonderful. Thank you very much for the code sample. There's something I'm doing wrong then. I'm going to try this today.