bamlab / react-native-image-resizer

🗻 Resize local images with React Native
MIT License
1.6k stars 342 forks source link

[TypeError: Cannot read property 'createResizedImage' of null] on Android #344

Closed longhann closed 1 year ago

longhann commented 1 year ago

"@bam.tech/react-native-image-resizer": "3.0.4" "react-native": "0.64.2" "react": "16.13.1"

It's work on IOS but show this on Android (simulator API 31). [TypeError: Cannot read property 'createResizedImage' of null] on Android

I've tried:

*Updated: yarn add react-native-image-resizer@1.1.0 and it works on Android but not in IOS at the same time as error so I installed both of 2 versions

tuan072090 commented 1 year ago

same error on android

longhann commented 1 year ago

@tuan072090 Not the best way but you can try the solution I mentioned

*Updated: yarn add react-native-image-resizer@1.1.0 and it works on Android but not in IOS at the same time as https://github.com/facebook/react-native/issues/23835 so I installed both of 2 versions

alessandrom commented 1 year ago

I am also facing this issue on Android only

alessandrom commented 1 year ago

Digging in the library I can see that isTurboModuleEnabled is false and NativeModules.ImageResizer is undefined meanwhile on iOS NativeModules.ImageResizer is correctly initialised

const ImageResizer = isTurboModuleEnabled
  ? require('./NativeImageResizer').default
  : NativeModules.ImageResizer;

I wonder if it may depend on a specific device

javier2409 commented 1 year ago

I'm having the same issue on Android with 3.0.4 version, iOS works fine. Downgrading to 1.4.5 worked on both OS for me.

hellocaio commented 1 year ago

I ran into this issue too, my problem was that I was using the wrong development client. I don't know if you are using a custom development client but if you are this might be the issue.

taboulot commented 1 year ago

Hi @longhann,

I was not able to reproduce it.

Did you find a solution ? If no, can you provide me a reproducible example ?

@CaioMars looks like you already faced the issue. You already gave this answer in #353.

Can you give me more details about what was the problem and how you fixed it ?

mljlynch commented 1 year ago

This is true for me as well - does this have something to do with hermes on android?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically closed. Thank you for your contributions.