2

I'm trying to use react-native-image-picker, but I'm getting the error: NativeModule.ImagePickermanager is null.

import React, { Component } from 'react';
import { Text, View, StyleSheet, Alert, PixelRatio, Image } from 'react-native';
import ImagePicker from 'react-native-image-picker';
...
handleChoosePhoto = () => {
    const options = {
      noData: true,
    };
    ImagePicker.launchImageLibrary(options, response => {
      if (response.uri) {
        this.setState({ photo: response });
      }
    });
};

...

<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
            {this.state.photo && (
    <Image
       source={{ uri: this.state.photo.uri }}
       style={{ width: 300, height: 300 }}
    />
  )}
  <Button title="Choose Photo" onPress={this.handleChoosePhoto} />
</View>

I tried to run react-native link react-native-image-picker. When I run this command, nothing happens. It does not show anything in the terminal. I'm using IOS simulator.

myTest532 myTest532
  • 2,091
  • 3
  • 35
  • 78

2 Answers2

5

I have been trying to resolve this error from last 8 hours but couldn't succeed. Please use ImagePicker from expo and here is its link. https://docs.expo.io/versions/latest/sdk/imagepicker/ It will resolve your error.

Saad Z.
  • 51
  • 1
3

I also have the same problem . This is what worked for me.

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