React Native - CameraRoll 遇到问题 undefined is not an object
React Native - CameraRoll got issue undefined is not an object
我使用 react-native-image-picker 从相机和照片库中获取图像。我按照 link 中的步骤和 xcode 中的 react-native-image-picker 进行操作。我还将编写代码以打开 imagePicker。但是有一个错误。
注意:我将使用 0.46 作为 React Native。
在 iOS 和 Android 中成功 link。
我的代码:
import { ImagePicker } from 'react-native-image-picker'
和 onButton :
handleImagePickUp = () =>{
ImagePicker.launchImageLibrary(options, (response) => {
});
}
错误:
而不是写
import { ImagePicker } from 'react-native-image-picker'
,
你应该声明(在同一个地方)...
var ImagePicker = require('react-native-image-picker');
。
您的其余代码应该可以工作,但由于未提供所以很难判断。希望这对您有所帮助,如果您不明白为什么必须这样做,请告诉我。
我使用 react-native-image-picker 从相机和照片库中获取图像。我按照 link 中的步骤和 xcode 中的 react-native-image-picker 进行操作。我还将编写代码以打开 imagePicker。但是有一个错误。
注意:我将使用 0.46 作为 React Native。
在 iOS 和 Android 中成功 link。
我的代码:
import { ImagePicker } from 'react-native-image-picker'
和 onButton :
handleImagePickUp = () =>{
ImagePicker.launchImageLibrary(options, (response) => {
});
}
错误:
而不是写
import { ImagePicker } from 'react-native-image-picker'
,
你应该声明(在同一个地方)...
var ImagePicker = require('react-native-image-picker');
。
您的其余代码应该可以工作,但由于未提供所以很难判断。希望这对您有所帮助,如果您不明白为什么必须这样做,请告诉我。