-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Examples and local implementation crash on ios browser #541
Comments
I finally managed to get access to an iOS device. I tested the website (https://valentinh.github.io/react-easy-crop/) and it works fine. What examples are you referring to? |
RPReplay_Final1718948373.MP4Hi! This happens with iOS. In my implementation in my project, the same thing happens. In my project, it doesn't crash automatically, but when cropping, it collapses and throws the same error Video if from this url -> https://codesandbox.io/s/v69ly910ql |
Are you able to share the exact error from the console please?
Le ven. 21 juin 2024, 08:00, erodriguezvesti ***@***.***> a
écrit :
…
https://github.com/ValentinH/react-easy-crop/assets/118006154/4d8ab581-6321-4e89-824e-2769a6e348fb
Hi! This happens with iOS. In my implementation in my project, the same
thing happens. In my project, it doesn't crash automatically, but when
cropping, it collapses and throws the same error
—
Reply to this email directly, view it on GitHub
<#541 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUN6UTVNNCPHOKFTCG6EWTZIO6PNAVCNFSM6AAAAABIOCMJAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBSGA2TSMBSG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
That's the problem. I tried to fix it or figure out the issue, but the console doesn't show any errors or logs. The browser just says "an error occurred" many times and crashes the page. |
What about the crash on your app, not on codesandbox? |
Here is real time console when web site crashes Screen.Recording.2024-06-21.at.02.49.33.movYou cannot see error messages about react easy crop |
https://codesandbox.io/p/sandbox/react-easy-crop-v69ly910ql fails on startup , i don't know why https://codesandbox.io/s/v69ly910ql not crashes |
It seems that the app crashes when the crop button is clicked. It means that the issue isn't happening in the lib code but in the cropping function. |
In my implementation? No only drag crop and crash, in code sanbox crop is loaded and crash |
can you test https://codesandbox.io/p/sandbox/react-easy-crop-v69ly910ql on ios device? |
update: Testing previous versions, version 5.0.2 works well and the browser does not crash |
Thanks for catching that. Then it means that 5.0.4 brought the issue. Are you using the objectFit property? |
since 5.0.3 crash on ios device. No, i'm not using objectFit, my code is really simple import { useModal } from "@/context/modal/modal.provider";
import { Button } from "@nextui-org/react";
import { useCallback, useRef, useState } from "react";
import Cropper from "react-easy-crop";
import getCroppedImg from "./get-cropped-img";
interface ICropImageProps {
b64: string;
onConfirm: (b64: string) => void;
onClose?: () => void;
cropRatio?: number;
}
const CropImage = ({
b64,
onConfirm,
onClose = () => {},
cropRatio = 1 / 1,
}: ICropImageProps) => {
const { closeModal } = useModal();
const [crop, setCrop] = useState({ x: 0, y: 0 });
const croppedAreaPixelsRef = useRef<any>(null);
const onCropComplete = useCallback((croppedArea, croppedAreaPixels) => {
croppedAreaPixelsRef.current = croppedAreaPixels;
}, []);
const showCroppedImage = useCallback(async () => {
try {
const croppedImage = await getCroppedImg(
b64,
croppedAreaPixelsRef.current,
0
);
onConfirm(croppedImage as string);
closeModal();
} catch (e) {
console.error(e);
}
}, [b64, onConfirm, closeModal]);
const onCloseCrop = useCallback(() => {
closeModal();
onClose();
}, [closeModal, onClose]);
return (
<div className="p-6">
<div style={{ minHeight: 350, height: 350 }} className="relative">
<Cropper
image={b64}
crop={crop}
aspect={cropRatio}
onCropChange={setCrop}
onCropComplete={onCropComplete}
/>
</div>
<div className="flex justify-between mt-6">
<Button onClick={onCloseCrop} color="danger" variant="bordered">
Cancelar
</Button>
<Button onClick={showCroppedImage} color="success">
Confirmar
</Button>
</div>
</div>
);
};
export default CropImage; |
So it doesn't crash on 5.0.2? What I don't get is that 5.0.3 only added changes to the README 🤔 |
I confirm that, at the first look, nothing looks suspicious in your code. I'll try to reproduce when I'm back on my computer. |
Sorry, I've been testing different versions for a while and the same thing happens with all of them. Sometimes it occurs less frequently, but you can still experience the same problem. The console doesn't show any error; everything just restarts. 😔😔😔 What seems most strange to me and could provide a clue is that in this URL https://codesandbox.io/p/sandbox/react-easy-crop-v69ly910ql the problem occurs, but in this one https://codesandbox.io/s/v69ly910ql it does not. |
What version of iOS are you testing on? Do you manage to reproduce on the preview url: https://v69ly910ql.csb.app? |
These are 2 different versions of the codesandbox editor. Therefore, I would say that the issue is more on the codesandbox side than on the lib itself. Are you able to create a small repository of your example that still reproduces the error and share it here please? The goal is to remove codesandbox from the equation. |
After a thousand tests, the error occurs when having a tracking provider like Clarity or Hotjar; when initializing the crop or moving the image, the site crashes. I imagine it must be issues with these services. For now, I solved it by disabling Clarity on my website. Many thanks for your help and follow-up. |
That's a point, the error only occurs on real devices. I couldn't reproduce it on the emulator either, but I did on four real devices. |
That's very interesting! I've never heard about such issues, it would be great to see at what line it throws so that we can fight a solution. |
that's all, simply open examples on ios mobile browser and page crashes. i try with locally implementation and got the same issue
The text was updated successfully, but these errors were encountered: