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

TypeError: null is not an object (evaluating 'ImageCropPicker.openPicker') #1762

Closed
SourceErr0r opened this issue Mar 29, 2022 · 5 comments
Closed

Comments

@SourceErr0r
Copy link

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.37.3
  • react-native v0.64.2

Platform

Tell us to which platform this issue is related

  • Android

Expected behaviour

Module works

Actual behaviour

Module fails to launch with error:
TypeError: null is not an object (evaluating 'ImageCropPicker.openPicker')

I can import the module with no issues. As soon as I add any reference to it in my code (I don't even have to call it, just include it in the code) I get the above error and the app completely fails to launch as it will break AppRegistry. For example, I've got a button onclick listener which is attempting to launch the image picker:

  const openPicker = () => {
    ImagePicker.openPicker({
      width: 255,
      height: 156,
      cropping: true,
    }).then(image => {
      console.log(image);
    });
  };
....
<TouchableOpacity style={styles.buttonStyle} onPress={() => openPicker()} />

I have to completely remove the reference to ImagePicker here or the code will not compile and just spits out errors - I've never encountered anything like this before, usually it won't error until I call the failing method!

Steps to reproduce

  1. Follow install instructions

  2. Run App on Android

Other info

I'm attempting to run this in a hybrid app (native app implementing some RN screens) but that should not be causing any problems here - everything works perfectly fine until I attempt to use this library. It is working without issue on iOS.

Have followed the additional instructions for installing in the readme.

I have attempted full cleans of the build, caches, node_modules, etc. but no luck.

@SourceErr0r
Copy link
Author

Solved it. I had to manually add PickerPackage to the list of RN packages. No idea why this isn't automatically being handled, I have not had this problem with any other packages.

Closing issue..

@anisimoves
Copy link

Solved it. I had to manually add PickerPackage to the list of RN packages. No idea why this isn't automatically being handled, I have not had this problem with any other packages.

Closing issue..

Hello.
I have the same problem. Can you please write more information how you fixed this? Where I need to add PickerPackage?

@fukemy
Copy link

fukemy commented Apr 20, 2022

exactly same problem when import ImagePicker from 'react-native-image-crop-picker';

@Rhadammanthis
Copy link

I managed to avoid this issue on iOS by manually adding

pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'

to my pod file and then running pod install

hope it might help

@AntonioLi1
Copy link

Hi,
Can you elaborate on what you meant by "manually add PickerPackage to the list of RN packages"?

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

5 participants