1

when i try to access the photos using react-native-image-picker it returns an error 'null is not an object(evaluating 'ImagePickerManager.showImagePicker')'.

i have tried linking the libraries deleting node modules and then again etc but none worked.

const ImagePicker = require("react-native-image-picker");

<TouchableOpacity
                    onPress={() => {
                        const options = {
                            title: "Select Profile Pic",
                            mediaType: "photo",
                            takePhotoButtonTitle: "Take a Photo",
                            maxWidth: 256,
                            maxHeight: 256,
                            allowsEditing: true,
                            noData: true
                        }
                    ImagePicker.showImagePicker(options, response => {
                        if (response.uri){
                            this.setState({photo: response})
                        }

                        })


firebase.storage.ref().child(`chatImg/${this.state.photo.uri}`);
                    }}
                    style={{ flexDirection: 'row' }}
                >
                    <View style={{ width: 15 }} />
                    <AutoHeightImage width={35} source= 
{require('../../resource/icon_attach.png')} />                    
                    <View style={{ width: 5 }} />
                </TouchableOpacity>
vishnu
  • 213
  • 1
  • 13

3 Answers3

0

adding the RNImagePicker.xcodeproj manually to xcode solved my issue.

vishnu
  • 213
  • 1
  • 13
0

I think there is a bug with the current version. I've experienced this, what I did was to uninstall the current version on the image-picker package, and installed the version @1.1.0:

npm uninstall react-native-image-picker

npm install react-native-image-picker@1.1.0 --save

react-native link react-native-image-picker

cd ios

pod install

cd ..

Stop your Packager or Bundler and re-run it again

npm start --rest-cache

Anayo Oleru
  • 468
  • 5
  • 8
0

Unistall the latest version npm uninstall react-native-image-picker Installed version 0.28.0 npm install react-native-image-picker@0.28.0 --save react-native link react-native-image-picker

Gurujustin
  • 437
  • 1
  • 5
  • 14