Kirit Modi
Kirit Modi

Reputation: 23407

React Native - CameraRoll got issue undefined is not an object

I used react-native-image-picker for fetch image form camera and photo library. i follow the steps to and link react-native-image-picker in xcode. I will code also to open imagePicker. but have an error.

Note : I will used 0.46 for react native.

Successfully link in iOS and Android.

enter image description here

My Code :

import { ImagePicker } from 'react-native-image-picker'

And onButton :

handleImagePickUp = () =>{
   ImagePicker.launchImageLibrary(options, (response)  => {
   });
}

Error :

enter image description here

Upvotes: 1

Views: 532

Answers (1)

Ryan Turnbull
Ryan Turnbull

Reputation: 3934

Instead of writing

import { ImagePicker } from 'react-native-image-picker',

you should declare ( In the same place )...

var ImagePicker = require('react-native-image-picker');.

The rest of your code should work, although it's hard to tell since its not provided. Hope this helps, if you dont understand why this must be done let me know.

Upvotes: 2

Related Questions