Cannot read Propery 'cropImage' of undefined
Cannot read Propery 'cropImage' of undefined
Hi anyone, can help me, I'm having an error. All of my data is present. I don't know why i'm getting this error
import ImageEditor from "@react-native-community/image-editor";
let cropData={
offset: {x: 0,y: 0},
size: {width: result.width,height: result.height},
displaySize: {width: 100,height: 100},
resizeMode: "contain"
};
ImageEditor.cropImage(result.uri,cropData).then(url => {
console.log("Cropped image uri",url);
})
//result.uri has data //cropData has data as well
Any ideas, thanks
i have the same problem.
I have the same problem, too.
Hi guys any update? I temporarily removed this snippet to make my app work.
i have the same problem.
Has anyone solved this yet? I have the same problem. It seems that cropImage calls RNCImageEditor.cropImage, and RNCImage is not defined.
I solved this problem by directly using ImageEditingManager.cropImage in Native modules from react-native.
import { NativeModules } from "react-native";
const { ImageEditingManager } = NativeModules;
ImageEditingManager.cropImage(
imageUri,
cropData,
(res) => {
setCroppedUri(res);
},
(e) => {
console.log(e);
}
ImageEditingManager.cropImage takes four arguments: imageuri, cropData(same structure), resolve func, reject func I'm using react-native version 0.63
Two years later, same problem. Using the NativeModules ImageEditingManager does seem to work though (at least on iOS — haven't tried on Android yet), so thank you for providing that solution.
Shouldn't be an issue if you are using the latest version