Add NSPhotoLibraryUsageDescription and NSCameraUsageDescription to info.plist
npm i react-native-image-crop-picker --save
react-native link react-native-image-crop-picker
Drag and drop the ios/ImageCropPickerSDK folder to your xcode project. (Make sure Copy items if needed IS ticked)
Click on project General tab
But still when i'm importing
import ImagePicker from 'react-native-image-crop-picker'
ImagePicker is undefined with all the consequences. In the example code you are referring to NativeModules. This doesn't work either.
Any suggestions?
this means some of installation steps failed. I highly recommend to use cocoapods for external libraries. It will make your life easier. Give it a try. You can check readme for more instructions.
I am having the same issue as @anton-aleksandrov. (I'm also using [email protected]). So I took your advice and started trying cocoapods.
Unfortunately, I am not experienced iOS developer so I have been looking at this guide to try and get cocoapods to work, but have had no success so far. Do you know of any good guides for getting cocoapods to work with React Native?
Secondly can you elaborate on this point: Drag and drop the ios/ImageCropPickerSDK folder to your xcode project. (Make sure Copy items if needed IS ticked). It's not clear to me where the SDK should go in the project, also what does IS stand for here?
Thank you very much for your help, this library looks awesome, and I'd love to use it in my project.
Found this tutorial on the react native website.
I am also getting same issue in android. The react-native link react-native-image-crop-picker command could not successfully link to my android app. So i have done manual steps for linking in android such as import com.reactnative.ivpusic.imagepicker.PickerPackage in my MainApplication.java file etc.
After that i have rebuild my project the error is cleared. So kindly you have to check react-native-image-crop-picker is linked to your ios app, if not do that manual steps which are needed for ios.
@Asha-Nellaiappan, try my PR above and see if that helps.
@ivpusic same error here on android dev white integrating to the existing app. or keeps reporting undefined is not an object (evaluating '_reactNativeImageCropPicker2.default.openPicker') if using openPicker method.
The project architecture is like this:

all the node modules are placed in RNComps folder while writing native code in android && iOS.
So is there any way to link the library?
any updates on this ? I have the same problem on iOS (not using pods)
I got it to work by running the following in console:
react-native unlink react-native-image-crop-picker
react-native link react-native-image-crop-picker
I had this problem also in iOS but like ivpusic said read the readme for instructions! There are also instruction when you don't want to use Cocoapods.
getting same issue
RN 0.46 ,
OS : windows 10
@asha-nellaiappan can you please elaborate manual steps for linking in android such as import com.reactnative.ivpusic.imagepicker.PickerPackage in my MainApplication.java file etc.
This thread is very helpful
https://github.com/ivpusic/react-native-image-crop-picker/tree/master/example , this has all the solutions , please refer to this link for setup
I got it working by doing @raynoppe steps. Thanks man!
Interestingly, I was facing the same problem with react-native run-ios however when I open the xcode project and build the app from there the problem just disappeared.
Also, I got rid of this by placing node_modules/react-native-image-crop-picker/ios/imageCropPicker.xcodeproj in my project and also adding libimageCropPicker.a to Linked Frameworks and Libraries.
Thanks! @luco its working by adding libimageCropPicker.a 馃榾
I fixed the same problem by Podfile.
https://github.com/ivpusic/react-native-image-crop-picker#step-2
i used the cocoapods way, but get the same error. Do you need to call react-native link react-native-image-crop-picker when using cocoapods?
For iOS: CocoaPods was enough
For Android: the react-native link react-native-omage-crop-picker command missed:
import com.reactnative.ivpusic.imagepicker.PickerPackage;
...
new PickerPackage(),
...
in MainApplication.java
Cheers!
for my case, follow the tree steps fix the issue(on ios)
1.install the lib with npm
2.drag the project file imageCropPicker.xcodeproj to the Libraries
2.under the "Linked Frameworks and Libraries" click add button then choose the "libimageCropPicker.a"
just write here if someone faces the same problem can try
I had the same error.
Most of you who have _linked it properly_ is still getting the error because you _did not build the app again_.
So all you have to do is:
npm install --save react-native-image-crop-picker
react-native link
react-native run-android
react-native start
This will solve your problem :smile: :+1:
Hello, I am having the same issue, undefined is not an object evaluating _reactNativeImageCropPicker2.default.openPicker
I am working only with Expo, and not doing deployments to IOS or Android.
I already tried unlink and link react-image-image-crop-picker with no luck
me too
I also encountered this error and had basically given up hope on using this library, but since there aren't any other great alternatives I persisted. I don't use cocoapods, but I installed according to the readme and was getting the "Cannot read property" error when calling the openPicker function. Turns out that calling "rm -rf node_modules/" and then "npm install" was the solution. Hope this helps someone.
I got it to work by closing Xcode and running pod install again, and then opening the workspace again
Thanks! @luco its working by adding
libimageCropPicker.a馃榾
@kantharia where is this file I can't see it?
Also, I got rid of this by placing
node_modules/react-native-image-crop-picker/ios/imageCropPicker.xcodeprojin my project and also addinglibimageCropPicker.ato Linked Frameworks and Libraries.
@luco what does "placing node_modules/react-native-image-crop-picker/ios/imageCropPicker.xcodeproj in my project " mean exactly? Do you copy paste that somewhere? I have not much idea about xcode and ios dev. Thanks!
I got rid of this by creating react-native-image-crop-picker folder inside node_modules and run cd ios && pod install
Most helpful comment
I got it to work by running the following in console:
react-native unlink react-native-image-crop-picker
react-native link react-native-image-crop-picker