Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The customCrop ref does not have a crop function. #51

Open
rosentoshev opened this issue Jun 30, 2020 · 3 comments
Open

The customCrop ref does not have a crop function. #51

rosentoshev opened this issue Jun 30, 2020 · 3 comments

Comments

@rosentoshev
Copy link

rosentoshev commented Jun 30, 2020

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

@usman64
Copy link

usman64 commented Sep 7, 2020

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

@Dheeeraj
Copy link

Dheeeraj commented Oct 3, 2020

@rosenexpend @usman64
you seem to use useRef()

try this
customCrop.current.crop()

@venxik
Copy link

venxik commented Nov 3, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants