我已经安装了包 react-native-image 选择器:
npm i react-native-image-picker --save
我还将它链接到我的项目:react-native link react-native-image-picker
当我尝试导入模块并使用它时:import ImagePicker from 'react-native-image-picker';
ImagePicker.launchImageLibrary(options, (response) => {
// code here
}
我收到以下错误:typeError: Cannot read property 'launchImageLibrary' of undefined
这里出了什么问题?
最佳答案
您应该仔细检查此 npm 包的最新文档,因为它已迁移到较新版本。旧的 2.x.x 版本已被弃用,如 GitHub 中所述包的页面,因此关键模块的名称可能已更改...
关于javascript - react-native-image-picker 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65239308/