3

I am using react-native-image-picker library to upload the image, it crashes the app when i select any image from gallery to upload. I am sharing the piece of code of it.

 import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
 handleChoosePhoto = () => {
   launchImageLibrary(
     {
      mediaType: 'photo',
      includeBase64: false,
      maxHeight: 200,
      maxWidth: 200,
     },(response) =>{
     console.log("image response is =>", response);
       }
   )
  }
   <TouchableOpacity onPress={() => this.handleChoosePhoto()}>
     <Text>upload</Text>
   </TouchableOpacity >

Above code display the console but after that app immediately crashes and no any error or warning in console. I checked the android studio logcat where i can see following error. java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.bridge.Callback.invoke(java.lang.Object[])' on a null object reference

Chandler Bing
  • 293
  • 4
  • 18

0 Answers0