从Expo图像选择器返回的未定义值

huangapple go评论55阅读模式
英文:

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 :

从Expo图像选择器返回的未定义值

英文:

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 :

从Expo图像选择器返回的未定义值

答案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.

huangapple
  • 本文由 发表于 2023年6月13日 05:56:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76460560.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定