1

I'm using React Native Image Picker but I get this error in response "Cannot launch photo library"

React Native Version = 0.60.3

This is my code

handleProfilePicture = async () => {
const options = {};

try {
  const granted = await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE ||
      PermissionsAndroid.PERMISSIONS.CAMERA,
    {
      title: 'Wants to access your gallery',
      buttonNeutral: 'Ask Me Later',
      buttonNegative: 'Cancel',
      buttonPositive: 'OK'
    }
  );
  if (granted === PermissionsAndroid.RESULTS.GRANTED) {
    ImagePicker.showImagePicker(options, res => {
      console.log('response', res);
    });
  } else {
    console.log('Gallery permission denied');
  }
} catch (err) {
  console.warn(err);
}

};

Tayab
  • 71
  • 9
  • Check here https://github.com/react-native-community/react-native-image-picker/issues/908#issuecomment-415690355 – DevAS Jul 28 '19 at 08:57

0 Answers0