URGENT ERROR: react-native-image-crop-picker does not open after expo-image-manipulator used
Here is a reproducible repo that contains the issue I will discuss below: https://github.com/jakeherm/image-picker-cropper-test
When I attempt to select an image or many images via expo-image-manipulator, then use react-native-image-crop-picker to crop them, the image crop picker library never opens.
This issue happens significantly less often when a 1s timeout is added, but I want to get to the bottom of the issue to solve why it is occuring.
after picking image from expo-image-picker i put my cropping code in seTimeout with 1 second timer it worked fine. Thanks:
const pickImage = async () => { try { // Request permission to access media library const permissionResult = await ImagePicker.requestMediaLibraryPermissionsAsync()
if (permissionResult.granted === false) {
alert("You've refused to allow this app to access your camera!")
return
}
// Open the image picker
const result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ['images'],
allowsEditing: false,
aspect: [1, 1],
quality: 1,
})
console.log('Picked image result is:', result)
setTimeout(async () => {
if (!result.canceled) {
const uri = result.assets[0].uri
try {
// Open image cropper
const cropped = await ImageCropPicker.openCropper({
cropping: true,
mediaType: 'photo',
path: uri,
width: 1080,
height: 1440,
})
console.log('Cropped image result is:', cropped)
// Return both original and cropped image URLs
return {
originalImage: uri,
croppedImage: cropped.path,
}
} catch (error) {
console.log(error)
}
} else {
// Image picker canceled
return null
}
}, 1000)
} catch (error) {
console.error(error)
return null
}
}
There are still extreme outlier cases where it does not work. Identifying the root cause would be beneficial.
Any updates on this? I have the same issue? It also hangs silently so it would be nice as a workaround to know whether it succeeded or not