I am using react-native-image-crop-picker and I have to choose multiple images so I did multiple true, Now I want crop all images those I selected. because if i am enabling the multiple true it is not cropping. Cropping working for single image selection.
I want to crop all images those I selected in react native
To achieve this, you can use the react-native-image-crop-picker library to select multiple images and then loop through the selected images to crop each one individually
try {
const selectedImages = await ImagePicker.openPicker({
multiple: true,
mediaType: 'photo',
});
// Loop through selected images and crop each one
selectedImages.forEach(async (image) => {
try {
const croppedImage = await ImagePicker.openCropper({
path: image.path,
width: 300,
height: 300,
});
console.log('Cropped image:', croppedImage);
// Do something with the cropped image, like uploading it to a server
} catch (cropError) {
console.error('Error cropping image:', cropError);
}
});
} catch (pickerError) {
console.error('Error selecting images:', pickerError);
}