I am using react-native-image picker and react-native-image-crop picker libraries in two class.
One is launching the library image (react-native-image picker) and other one package opens the cropping window(react-native-image-crop-picker).
Here the launching library is in one screen and cropper is opening while navigating from the library on another screen.
My issue is after click on the choose-in cropping window it again reset the cropping window and need to crop again and illegal invocation error occurs after this.
Refer the code sniipet
// Opens the library image in Library.js screen
import ImagePicker from 'react-native-image-picker';
ImagePicker.launchImageLibrary(options, (response) => {
if (response.didCancel) {
console.warn('User cancelled photo picker');
}
else if (response.error) {
console.warn('ImagePicker Error: ', response.error);
}
else {
this.props.navigation.navigate('CropWindow', { screenName: 'CropImage',uri: response.uri});
}
The below is for the cropping window in CropWindow.js
import ImagePicker from 'react-native-image-crop-picker';
ImagePicker.openCropper({
path: response,
width: deviceWidth,
height: deviceWidth*5/4
}).then(image => {
this.props.navigation.navigate('ShowAllCroppedImage', {uri: response.uri, croppedImage: this.croppedImage.bind(this)});
})
.catch((err) => {
console.log("openCropper error = " + err)
});