Unhandled Promise Rejection (id:0) ImagePicker

I am trying to use ImagePicker but I keep getting this warning and nothing works.
My Code

export const uploadFromGallery =  function (){    
    return new Promise(async function(resolve, reject){
        var result = await ImagePicker.launchImageLibraryAsync({
            allowsEditing: true, 
            aspect: [4,3]


Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not a function (evaluating '_expo2.default.launchImageLibraryAsync')

1 Like

How are you importing ImagePicker? You probably want something like this:

import Expo, { ImagePicker } from 'expo';

no. I am importing it like

import ImagePicker from 'expo'

The thing is I was creating a util.js where I am coding all the camera related functions and then importing it on various other screens. Calling it directly works. But when I am trying to code the funtion somewhere and import it, it throws this error

Were you able to resolve this issue?