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

backToCrop and resetting the photo to the initial one results croppedState.loading to end up true #16

Open
ionistrati opened this issue Aug 19, 2021 · 0 comments

Comments

@ionistrati
Copy link

ionistrati commented Aug 19, 2021

const [file, setFile] = useState<File | null>(null);
const [croppedFile, setCroppedFile] = useState<File | null>(null);

I have these two states, file is the initial one, croppedFile is passed to the component, on reset, I want to redo the crop from the file I already have, so this means to reassign the file to the cropped one state setCroppedFile(file).

const resetCrop = () => {
    setCroppedFile(file);
    cropperRef?.current?.backToCrop();
  };

This ends up leaving loading on true.

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

1 participant