react-native-perspective-image-cropper icon indicating copy to clipboard operation
react-native-perspective-image-cropper copied to clipboard

The customCrop ref does not have a crop function.

Open rosentoshev opened this issue 5 years ago • 3 comments

The customCrop ref does not have a crop function and I cannot get the perspective image crop to work. I have console.log of the customCrop ref and the properties are in the attached screenshot below. There is no crop at all. This is the code of the render and crop function. I would appreciate any assistance to get the react-native-perspective-image-cropper to work as intended. My repo can be found at this link: https://github.com/rosenexpend/ScannerImageCropper

function crop() { customCrop.crop(); }

return ( <View> <CustomCrop ref={customCrop} updateImage={updateImage} rectangleCoordinates={rectangleCoordinates} initialImage={image} height={DEFAULT_IMAGE_HEIGHT} width={DEFAULT_IMAGE_WIDTH} overlayColor="rgba(18,190,210, 1)" overlayStrokeColor="rgba(20,190,210, 1)" handlerColor="rgba(20,150,160, 1)" enablePanStrict={false} /> <TouchableHighlight style={styles.cropButtonTouchable} onPress={crop}> <View style={styles.cropButton}> <Text style={styles.cropButtonLabel}>Crop</Text> </View> </TouchableHighlight> </View> ); }

Screenshot 2020-06-30 at 11 40 11

rosentoshev avatar Jun 30 '20 08:06 rosentoshev

Hey @rosenexpend did you find a solution? I'm getting the same issue as the image is not being cropped.

usman64 avatar Sep 07 '20 07:09 usman64

@rosenexpend @usman64 you seem to use useRef()

try this customCrop.current.crop()

Dheeeraj avatar Oct 03 '20 00:10 Dheeeraj

it actually does have the function, try to addconsole.log() in your updateImage function, you will see the function is being called.

venxik avatar Nov 03 '20 06:11 venxik