In lower versions of iOS, only a portion of the screen can be captured
Describe it simply:
This issue was reproduced in iOS 14, but it worked properly in iOS 18.
It was expected that we should produce a normal image, but in fact I got one that was of the same size as the expected image, but only the upper left corner of the content was captured. The same code was tested normally on other platforms.
~~Oh I hate iOS : (~~
Quick demo to reproduce
const res = await snapdom(componentRef.current, {
quality: isIOS() ? 0.6 : 0.7,
type: 'jpeg',
});
Anything else we should know?
I am using the latest version (v1.9.4) of SnapDOM. Perhaps it's a compatibility issue with a lower version of iOS.
I think the problem may stem from the fact that different versions of iOS handle scale differently?
Any response will be very appreciated.
I share the same feelings! 😀
You may try V1.9.6 but I'm almost sure you will get same results
Yes, there is a hack with scale on Safari. But I believe you may test with earlier snapdom versions maybe under 1.0.0. Because that fix easy introduced later
I share the same feelings! 😀
You may try V1.9.6 but I'm almost sure you will get same results
Yes, I've updated to v1.9.6, but the problem hasn't been solved. Do you have any ideas? html-to-image doesn't have this problem, but it often loses my pictures and doesn't work in some specific scenarios, lol.
Yes, there is a hack with scale on Safari.
I think so too. I also found compatibility issues with scale on caniuse.
But I believe you may test with earlier snapdom versions maybe under 1.0.0. Because that fix easy introduced later
Do you have a workaround?
If you find it works on an earlier version I can try to make a strong "hack"
@tinchox5 I tried to switch to snapdom v0.9.9, but there was no improvement except that it was slower than the latest version - I still got a screenshot with only the upper left corner. Should I try a lower version?
Yes please there is a version without the hack. But if you want, test with last version, just search isSafari() calls and comment the code
@tinchox5 Hi, I tried the earliest version (v0.9.1), but it seems there haven't been any more improvement.
I checked your source code, and I didn't pass in the scale parameter, which means snapdom should use the default parameter scale: 1. When the scale is 1, all the related logic seems not to have an impact. : (
I got some days off. But when I have time I Will make a new version without the scale hack so you can try it
Testing with chrome an safari on desktop, I am seeing the scale field indeed result in differing behavior. On chrome it seems to render the entire image still, whereas safari it cuts off the image. A way to output properly scaled on safari mac/iOS would be nice
is that with ios > 14?
@tinchox5 this is on a macbook running sequouia 15.3.2 and testing from different browsers.
Thank you Safari is giving me a lot of unpleasant sorprises lately. But I will try to solve them
Just tested on iOS with chrome and safari browsers as well. Also seeing the same experience as safari on mac, where the image is scaled up but it is completely cut off. Thanks and hope we can get these resolved soon :)
Yes, there will be not problems just I'm taking a holidays and I'm not always in front of a computer
Yes, there will be not problems just I'm taking a holidays and I'm not always in front of a computer
Never mind, I reproduced this issue on my MacBook too. I will also help you with this problem. There is too many compability issues on iOS, lol.
Please share the snapdom code detailing scale and export format. I believe there is an issue when exporting scale > 1 and bitmaps format like jpg.
Solved! My bad.
Solved! My bad.
Could you please create a new release so I can have a test? :D
Changes are already in main branch. You can clone the repo, run npm install and then npm run compile.
Or wait some hours and I will make a pre-release version