Reputation: 23407
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.
My Code :
import { ImagePicker } from 'react-native-image-picker'
And onButton :
handleImagePickUp = () =>{
ImagePicker.launchImageLibrary(options, (response) => {
});
}
Error :
Upvotes: 1
Views: 532
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