Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error in some android devices when cropping the images #148

Open
vivek-oyela opened this issue Mar 14, 2024 · 4 comments
Open

getting error in some android devices when cropping the images #148

vivek-oyela opened this issue Mar 14, 2024 · 4 comments

Comments

@vivek-oyela
Copy link

vivek-oyela commented Mar 14, 2024

Environment

React native - 0.72.6
react-native-image-editor - 4.0.0

Description

Getting an error in crashlytics when trying to crop the image in Android. This issue is coming in some Samsung and xiaomi devices.

{
  nativeStackAndroid: [
    {
      lineNumber: 574,
      file: 'IoBridge.java',
      methodName: 'open',
      class: 'libcore.io.IoBridge',
    },
    {
      lineNumber: 160,
      file: 'FileInputStream.java',
      methodName: '<init>',
      class: 'java.io.FileInputStream',
    },
    {
      lineNumber: 115,
      file: 'FileInputStream.java',
      methodName: '<init>',
      class: 'java.io.FileInputStream',
    },
    {
      lineNumber: 1523,
      file: 'ContentResolver.java',
      methodName: 'openInputStream',
      class: 'android.content.ContentResolver',
    },
    {
      lineNumber: 326,
      file: 'ImageEditorModuleImpl.kt',
      methodName: 'openBitmapInputStream',
      class: 'com.reactnativecommunity.imageeditor.ImageEditorModuleImpl',
    },
    {
      lineNumber: 194,
      file: 'ImageEditorModuleImpl.kt',
      methodName: 'cropTask',
      class: 'com.reactnativecommunity.imageeditor.ImageEditorModuleImpl',
    },
    {
      lineNumber: 53,
      file: 'ImageEditorModuleImpl.kt',
      methodName: 'access$cropTask',
      class: 'com.reactnativecommunity.imageeditor.ImageEditorModuleImpl',
    },
    {
      lineNumber: 158,
      file: 'ImageEditorModuleImpl.kt',
      methodName: 'invokeSuspend',
      class: 'com.reactnativecommunity.imag',
    },
  ],
}
@retyui
Copy link
Collaborator

retyui commented Mar 15, 2024

@vivek-oyela Could you please provide the next things:

  • Error message
  • Android version
  • Simple repo/example to reproduce this bug

@retyui
Copy link
Collaborator

retyui commented Mar 19, 2024

@vivek-oyela ping

@vivek-oyela
Copy link
Author

vivek-oyela commented Mar 21, 2024

I am getting that error in Firebase Crashlytics. It's just that object.
Android versions are 11, 13, and 14.

I am using this way

     for (let i = 0; i < rawImages.length; i++) {
        let cropRatio: any = {};
        if (rawImages[i]?.hasOwnProperty('cropData')) {
          cropRatio = rawImages[i]?.cropData;
        } else {
          cropRatio = calculateImgOffsetAndSize({
            imgHeight: rawImages[i]?.height,
            imgWidth: rawImages[i]?.width,
            rHeight: imageCropperProps.height,
            rWidth: imageCropperProps.width,
          });
        }
        const {uri} = await ImageEditor.cropImage(rawImages[i]?.uri, {
          ...cropRatio,
        });
        newImages.push({
          ...rawImages[i],
          cropData: cropRatio,
          croppedUri: uri,
        });
      }

@vivek-oyela
Copy link
Author

This error is mostly on Samsung and Xiaomi devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants