英文:
Undefined Values Returning from Expo Image Picker
问题
I am trying to use expo-image-picker library to get access to the gallery and choose an image from the gallery and display it on the screen. But when I choose a picture, I console.log the result and it turns out that everything in the result is undefined.
here is the code :
const handleImageSelect = async () => {
setImageLoading(true);
let result = await ImagePicker.launchImageLibraryAsync({
allowsEditing: true,
quality: 1,
});
if (!result.canceled) {
console.log(result);
} else {
alert('You did not select any image.');
}
setImageLoading(false);
};
Here is the error message I am getting :
英文:
I am trying to use expo-image-picker library to get access to the gallery and choose an image from the gallery and display it on the screen. But when I choose a picture, I console.log the result and it turns out that everything in the result is undefined.
here is the code :
const handleImageSelect = async () => {
setImageLoading(true);
let result = await ImagePicker.launchImageLibraryAsync({
allowsEditing: true,
quality: 1,
});
if (!result.canceled) {
console.log(result);
} else {
alert('You did not select any image.');
}
setImageLoading(false);
};
Here is the error message I am getting :
答案1
得分: 0
问题出在expo-image-picker、react和react-native的版本上。我通过检查警告重新安装了所有内容,现在可以正常工作。
英文:
So, The problem was with the versions of expo-image-picker, react and react-native. I reinstalled everything by checking the warnings and it works fine now.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论