bamlab/react-native-image-resizer

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

longhann opened this issue · 10 comments

"@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:

  • Use autolink by re-installing packages with --save npm install (yarn) @bam.tech/react-native-image-resizer --save => fail
  • Run link command yarn react-native link @bam.tech/react-native-image-resizer => only link for IOS

*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

same error on android

@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 facebook/react-native#23835 so I installed both of 2 versions

I am also facing this issue on Android only

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

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.

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.

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 ?

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

stale commented

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 commented

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