question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[expo-image-picker] undefined is not an object

See original GitHub issue

Summary

undefined is not an object (evaluating ‘_ExponentImagePicker.default.requestMediaLibraryPermissionsAsync’)

Here’s the code 💻

// Camera & Image Picker
import * as ImagePicker from 'expo-image-picker';


const openImagePicker = async () => {
    try {
        // Ask the user for the permission to access the media library 

        const permissionResult = await ImagePicker.requestMediaLibraryPermissionsAsync()


        if (permissionResult.granted === false) {
            alert("You've refused to allow this appp to access your photos!");
            return;
        } 

        const result = await ImagePicker.launchImageLibraryAsync();

        // Explore the result
        console.log(result);

        if (result.cancelled === false) {
            setPickedImagePath(result.uri);
            console.log(result.uri);
        }
    } catch (error) {
        alert('Error Occur: ' + error.message)
        closeSheet()
    }
}

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

44

Environment

Expo CLI 5.0.3 environment info: System: OS: macOS 12.2 Shell: 5.8 - /bin/zsh Binaries: Node: 14.18.1 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 6.14.15 - /usr/local/bin/npm Watchman: 2022.01.17.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 IDEs: Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild npmPackages: expo: ^44.0.0 => 44.0.5 react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 react-native: ~0.63.4 => 0.63.4 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: eas-cli: 0.45.1 expo-cli: 5.0.3 Expo Workflow: bare

Reproducible demo

https://i.stack.imgur.com/xOacj.png

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
yarinsncommented, Jan 24, 2022

As i experienced it only on the standalone version, I tried rebuilding my app and publishing it again (ios) and it worked. I didnt need to downgrade (using expo 44).

2reactions
markrachapoomcommented, Jan 24, 2022

I managed to fix that by downgrading expo to 42, just a workaround not the explicit solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react native - TypeError: undefined is not an object (evaluating ...
Using React Image Picker i am facing this error: TypeError: undefined is not an object (evaluating '_reactNativeImagePicker.default.
Read more >
ImagePicker - Expo Documentation
expo -image-picker provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the...
Read more >
undefined is not an object (evaluating '_ExponentImagePicker ...
Coding example for the question undefined is not an object (evaluating '_ExponentImagePicker.default.requestMediaLibraryPermissionsAsync') in expo-image-picker.
Read more >
null is not an object (evaluating 'imagecroppicker.openpicker ...
I am running my react-native app through the expo. The same thing is happening with react-native-image-picker. I tried using react-native link react-native- ...
Read more >
react-native-image-picker - npm
Android. No permissions required ( saveToPhotos requires permission check). Note: This library does not require Manifest.permission.CAMERA, if ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found