react-nativeexporeact-native-image-pickerexpo-image-picker

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 :

enter image description here


Solution

  • 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.