TypeError: undefined is not an object (evaluating '_reactNativeImagePicker.default.launchImageLibrary') 1

TypeError: undefined is not an object (evaluating ‘_reactNativeImagePicker.default.launchImageLibrary’)

// I had this same issue and this is how I solved it.
import * as ImagePicker from "react-native-image-picker"

Here is what the above code is Doing:
1. Importing the ImagePicker from react-native-image-picker
2. Creating a function called selectImage
3. Creating a variable called options that contains the following:
a. title: “Select Avatar”
b. customButtons: [{ name: “fb”, title: “Choose Photo from Facebook” }]
c. storageOptions: {
skipBackup: true,
path: “images”
4. Calling the ImagePicker.showImagePicker function and passing in the options variable
5. If the user cancels the image picker, then we return
6. If the user selects an image, then we set the state of the image to the URI of the image

Similar Posts