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
目前,我正在通过终端和Atom编辑器运行我的响应本机项目。我正在尝试使用来自https://github.com/marcshilling/- image-picker的rect-native-image-picker,并遵循安装的说明:npm安装了该命令-本机-image-picker@latest——save。
And my dependencies
show: "react-native-image-picker": "^0.22.8"
我的依赖关系显示:“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
然后,我尝试了下面的例子,但我仍然在ImagePicker上得到一个错误。当我按下按钮来选择一个图像时(选项,(response) =>{…}):不能读取未定义的属性'showImagePicker'。
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:
所以我从“反应-本机-image-picker”导入ImagePicker,这就是它是如何在示例项目中实现的,它是来自于“反应-本机-image-picker”,它记录了:
So I cloned the Example project and also console.log(ImagePicker)
and it showed:
因此,我克隆了这个示例项目,也克隆了console.log(ImagePicker),它显示:
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?
我开始相信,问题是我没有得到我应该得到的功能,比如launchCamera和launchImageLibrary。我似乎弄不明白为什么。我可能错过了什么或者做错了什么?
1 个解决方案
#1
1
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:
你使用的是什么版本的RN和iOS ?如果您确定将npm包与本机代码(rnpm链接)连接起来,您可以尝试添加您的信息。plist(右键->作为源代码打开)在
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
#1
1
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:
你使用的是什么版本的RN和iOS ?如果您确定将npm包与本机代码(rnpm链接)连接起来,您可以尝试添加您的信息。plist(右键->作为源代码打开)在
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>