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

Cube Effect in Swiper Not Working Properly with needPerspectiveFix in iOS 14.x Webview #7864

Open
5 of 6 tasks
txiejun opened this issue Jan 23, 2025 · 1 comment
Open
5 of 6 tasks

Comments

@txiejun
Copy link

txiejun commented Jan 23, 2025

Check that this is really a bug

  • I confirm

Reproduction link

https://codepen.io/txiejun/pen/azoRGdK

Bug description

I am experiencing an issue with the Cube Effect in Swiper version 11.2.1 on iOS 14.x devices within a webview (jd app). The 3D carousel images appear larger compared to those in the Safari browser. By adding the overflow:hidden; style to the swiper container, the issue becomes more apparent.
Upon reading the source code and debugging, I found that the problem lies in determining the value of needPerspectiveFix based on the userAgent. In this scenario, the correct value is not being obtained, leading to an error in calculating the zFactor for the cube effect. This results in different behaviors between the webview and Safari browser.

Image

Problematic userAgent in jd app webview:
"jdapp;iphone;15.0.0;;;m/5.0;appbuild/15.0.0;jdsupportdarkmode/0;ef/1;ep/%7b%22ciphertype%22%3a5%2c%22cipher%22%3a%7b%22ud%22%3a%22ytc5cwczdzrwywo4cwdsyzgzdwc4cnhwztundqtrequ2enuycwo1cq%3d%3d%22%2c%22sv%22%3a%22cjgkcm%3d%3d%22%2c%22iad%22%3a%22%22%7d%2c%22ts%22%3a1737539181%2c%22hdid%22%3a%22jm9f1ywupwflvmipypok0tt5k9kw4arjeu3lflhxbqw%3d%22%2c%22version%22%3a%221.0.3%22%2c%22appname%22%3a%22com.qzibuy.mobile2%22%2c%22ridx%22%3a-1%7d;mozilla/5.0 (iphone; cpu iphone os 14_3 like mac os x) applewebkit/605.1.15 (khtml, like gecko) mobile/15e148;supportjdshwk/1;"
Safari browser userAgent:
"mozilla/5.0 (iphone; cpu iphone os 14_3 like mac os x) applewebkit/605.1.15 (khtml, like gecko) version/14.0.2 mobile/15e148 safari/604.1"

Expected Behavior

In Safari browser display is OK:

Image

The Cube Effect should display images at the same size as in the Safari browser on the same device.

Actual Behavior

In webview display is not OK:

Image

On iOS 14.x devices, the Cube Effect images are enlarged, resulting in more cropping.

Swiper version

11.2.1

Platform/Target and Browser Versions

iOS version: 14.x;Webview environment: jd app webview opened via QR code scan

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@nolimits4web
Copy link
Owner

No plans to support iOS 14 so PR is welcome

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

No branches or pull requests

2 participants