guhungry / react-native-photo-manipulator

React Native Image Processing API to edit photo programmatically for Android and iOS. It features print text, overlay on another image (add watermark), resize, crop, flip, rotate and optimize image size then convert file format to jpeg or png
MIT License
331 stars 38 forks source link

Error printText image: [TypeError: null is not an object (evaluating 'RNPhotoManipulator.printText')] #855

Closed saim683 closed 1 month ago

saim683 commented 2 months ago

I have facing an issue of Error printText image: [TypeError: null is not an object (evaluating 'RNPhotoManipulator.printText')]. when i console RNPhotoManipulator i got the functions in the console. {"RNPhotoManipulator": {"batch": [Function batch], "crop": [Function crop], "flipImage": [Function flipImage], "optimize": [Function optimize], "overlayImage": [Function overlayImage], "printText": [Function printText], "rotateImage": [Function rotateImage]}} But when I pass the URI ,text and mimeType. I got the error mentioned above. here is my code

const handleManipulation = async imageUri => { try { const mimeType = 'image/jpeg'; const image = 'https://unsplash.com/photos/qw6qQQyYQpo/download?force=true'; const texts = [ { position: {x: 50, y: 30}, text: 'Text 1', textSize: 30, color: '#000000', }, { position: {x: 50, y: 30}, text: 'Text 1', textSize: 30, color: '#FFFFFF', thickness: 3, }, ];

  await RNPhotoManipulator.printText(image, texts, mimeType).then(path => {
    console.log(`Result image path: ${path}`);
  });
} catch (error) {
  console.error('Error cropping image:', error);
}

};

guhungry commented 2 months ago

Hi @saim683, I would like to ask you a few questions.

  1. What is the version of this library you are using?
  2. Are you using Expo?
  3. What is your React Native version?
  4. Do you enable newArch in React Native?

FYI: It errors in this lines, most of the time root cause is the library not linked correctly, or native code is not compiled yet, or using Expo https://github.com/guhungry/react-native-photo-manipulator/blob/master/src/PhotoManipulator.ts#L95-L99

saim683 commented 2 months ago

Hi Guhungry/React-Native-Photo-Manipulator. The answers to the questions are as follows.

  1. I am using the 1.5.2 version of the library.
  2. No, I am using react-native cli.
  3. I am using the 0.64.4 version of the react native cli

Thank you for asking

On Fri, Jul 19, 2024 at 9:57 PM Woraphot Chokratanasombat < @.***> wrote:

Hi @saim683 https://github.com/saim683, I would like to ask you a few questions.

  1. What is the version of this library you are using?
  2. Are you using Expo?
  3. What is your React Native version?

— Reply to this email directly, view it on GitHub https://github.com/guhungry/react-native-photo-manipulator/issues/855#issuecomment-2239647207, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5BZLL6477JSSL22YDSZFRLZNFAPLAVCNFSM6AAAAABLE2S72KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZZGY2DOMRQG4 . You are receiving this because you were mentioned.Message ID: @.***>

guhungry commented 2 months ago

Hello @saim683 again,

Which platforms are you having problem? Android, ios or both

guhungry commented 2 months ago

Hi @saim683, It should be fixed in v1.5.3 🎉 🎉 🎉 🎉 🎉

If you still have a problem feel free to repoen this issue

saim683 commented 1 month ago

Hi Guhungry/React-Native-Photo-Manipulator Hope you are doing well. After installing the latest version my app didn't run. It returns the error of Execution failed for task ':react-native-photo-manipulator:compileDebugKotlin And my kotlin version is 1.5.10. I updated my kotlin_version to '1.5.31'. But I'm still getting the same error.

On Sun, Jul 21, 2024 at 7:04 PM Woraphot Chokratanasombat < @.***> wrote:

Hi @saim683 https://github.com/saim683, It should be fixed in v1.5.3 https://github.com/guhungry/react-native-photo-manipulator/releases/tag/v1.5.3 🎉 🎉 🎉 🎉 🎉

If you still have a problem feel free to repoen this issue

— Reply to this email directly, view it on GitHub https://github.com/guhungry/react-native-photo-manipulator/issues/855#issuecomment-2241622831, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5BZLL5PELT5LX2UL6IDXQ3ZNO5XNAVCNFSM6AAAAABLE2S72KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGYZDEOBTGE . You are receiving this because you were mentioned.Message ID: @.***>

guhungry commented 1 month ago

Hi @saim683 Can you update kotlin version to 1.9.24? You also need to update gradle wrapper to 6.8.3 too.

saim683 commented 1 month ago

Hi Guhungry/React-Native-Photo-Manipulator

So there is an issue that when i update my kotlin version and gradle wrapper my app doesn't run. Many packages are not supported to the latest version of kotlin and gradle wrapper. Is there any other possible way to fix this?

Thank you for guidance

On Mon, Jul 22, 2024 at 9:39 PM Woraphot Chokratanasombat < @.***> wrote:

Hi @saim683 https://github.com/saim683 Can you update kotlin version to 1.9.24? You also need to update gradle wrapper to 6.8.3 too.

— Reply to this email directly, view it on GitHub https://github.com/guhungry/react-native-photo-manipulator/issues/855#issuecomment-2243379877, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5BZLLYZG5EMGIPKAE3Z5TTZNUYSNAVCNFSM6AAAAABLE2S72KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBTGM3TSOBXG4 . You are receiving this because you were mentioned.Message ID: @.***>

guhungry commented 1 month ago

Hi @saim683,

It should be fixed in v1.5.4 🎉 🎉 🎉 🎉 🎉

Hi Guhungry/React-Native-Photo-Manipulator Hope you are doing well. After installing the latest version my app didn't run. It returns the error of Execution failed for task ':react-native-photo-manipulator:compileDebugKotlin And my kotlin version is 1.5.10. I updated my kotlin_version to '1.5.31'. But I'm still getting the same error.

But you might need to config kotlin version with kotlinVersion too, so in your case it should be

buildscript {
    ext {
        ...
        kotlin_version = "1.5.10"
        kotlinVersion = "1.5.10"
    }
    ...
saim683 commented 1 month ago

Thanks, it worked.

On Wed, Jul 24, 2024 at 12:57 AM Woraphot Chokratanasombat < @.***> wrote:

Hi @saim683 https://github.com/saim683,

It should be fixed in v1.5.4 https://github.com/guhungry/react-native-photo-manipulator/releases/tag/v1.5.4 🎉 🎉 🎉 🎉 🎉

Hi Guhungry/React-Native-Photo-Manipulator Hope you are doing well. After installing the latest version my app didn't run. It returns the error of Execution failed for task ':react-native-photo-manipulator:compileDebugKotlin And my kotlin version is 1.5.10. I updated my kotlin_version to '1.5.31'. But I'm still getting the same error.

But you might need to config kotlin version with kotlinVersion too, so in your case it should be

buildscript { ext { ... kotlin_version = "1.5.10" kotlinVersion = "1.5.10" } ...

— Reply to this email directly, view it on GitHub https://github.com/guhungry/react-native-photo-manipulator/issues/855#issuecomment-2246183454, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5BZLL6ZPGGL7ZASEXQQYC3ZN2YSRAVCNFSM6AAAAABLE2S72KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBWGE4DGNBVGQ . You are receiving this because you were mentioned.Message ID: @.***>