Currently I am running my React Native project via terminal and Atom editor. I am trying to use rect-native-image-picker from https://github.com/marcshilling/react-native-image-picker and followed the instructions to install: npm install react-native-image-picker@latest --save
And my dependencies
show: "react-native-image-picker": "^0.22.8"
Then I tried following the exact example, yet I am still getting an error on ImagePicker.showImagePicker(options, (response) => {...})
when I press the button to choose an image: Cannot read property 'showImagePicker' of undefined
So I console.log(ImagePicker)
of import ImagePicker from 'react-native-image-picker'
, which is exactly how it is implemented in the Example project from react-native-image-picker, and it logged:
So I cloned the Example project and also console.log(ImagePicker)
and it showed:
I am starting to believe that the issue is that I am not getting functions that I am supposed to get, such as launchCamera
and launchImageLibrary
. I can't seem to figure out why. What could I be missing or doing incorrectly?
What version of RN and iOS do you use? If you are sure that you linked npm package with native code (rnpm link
), you can try add to your Info.plist
(right key -> Open as source code) between <dict>
tags:
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
I have also faced the same issue. So in the documentation, the auto-linking is given but it is not linking all the dependency. You need to link some dependency manually. Please follow this below link it will help you. For manually linking follow this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With