React-native-image-crop-picker: Error: User cancelled image selection

Created on 23 Oct 2020  路  3Comments  路  Source: ivpusic/react-native-image-crop-picker

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.35.1
  • react-native v0.61.5

Platform

Tell us to which platform this issue is related

  • Android

Expected behaviour

on a camera screen we have a button of upload, press the upload button opens the ImagePicker.openPicker, select nothing and go back Error User cancelled image selection along with the the camera capture button doesn't take any picture, camera capture function is called but does not allow the image to preview because of Error User cancelled image selection

Actual behaviour

on a camera screen if we navigate to gallery then coming back without even selecting anything the camera function should work which is working if clicked but the screen should change to preview which doesn't change. All I see is the camera still on which shouldn't be on.

Fixes already tried

  1. await ImagePicker.openPicker({}).then({}).catch((err)->{console.log(err)})

  2. try{whateverintheFunction }catch(err){console.log(err)}

  3. changes in android.manfest.xml file under activity section android:launchMode="singleTop"

none of these solution works, kindly suggest me something TIA

Most helpful comment

inside catch(error)...

if (error.code === 'E_PICKER_CANCELLED') {
  return false;
}

All 3 comments

Used like this and works like charm;

try { const image = await ImagePicker.openCropper({ path: uri, height: 385, width: 1000, }); } catch(error){ console.log("Error:", error); }

@kutaisan i am implementing it if it occurs again what is the fix then ?

inside catch(error)...

if (error.code === 'E_PICKER_CANCELLED') {
  return false;
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

cwRichardKim picture cwRichardKim  路  3Comments

fmcruz picture fmcruz  路  3Comments

pavsidhu picture pavsidhu  路  3Comments

sergiulucaci picture sergiulucaci  路  3Comments

tximpa91 picture tximpa91  路  3Comments