problem with expo-image-picker: TypeError: ImagePicker.requestMediaLibraryPermissi onsAsync is not a function

Viewed 517

I have a functions to take a picture from the cell phone library, when I run the code the following warning is display:

[Unhandled promise rejection: TypeError: ImagePicker.requestMediaLibraryPermissionsAsync is not a function. (In 'ImagePicker.requestMediaLibraryPermissionsAsync()', 'ImagePicker.requestMediaLibraryPermissionsAsync' is undefined)]

Here are my import

import * as ImagePicker from 'expo-image-picker';

And here are the function:

    const pickImage = async () => {
        let result = await ImagePicker.launchImageLibraryAsync({
            mediaTypes: ImagePicker.MediaTypeOptions.All,
            allowsEditing: true,
            aspect: [3, 4],
            quality: 1,
        });

        if (!result.cancelled) {
            setImage(result.uri);
        }
    };
1 Answers

I was having the same issue but I find that the correct documentation for the SDK version I'm using.

In my case was changing the function to ImagePicker.getCameraRollPermissionsAsync().

Here's a link to the expo's image picker documentation and you can select your version at the top on the left-hand side menu.

Related