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

Swiper Event Propagation with safari webview in native #7839

Closed
5 of 6 tasks
Muscardinus94 opened this issue Jan 6, 2025 · 2 comments
Closed
5 of 6 tasks

Swiper Event Propagation with safari webview in native #7839

Muscardinus94 opened this issue Jan 6, 2025 · 2 comments
Labels

Comments

@Muscardinus94
Copy link

Muscardinus94 commented Jan 6, 2025

Check that this is really a bug

  • I confirm

Reproduction link

No Reproduction Link

Bug description

I am using swiper.js in a next.js based web
and using it in an Mobile Application as a webview in a tab bar

can't know why the swiper swiping effect is having something like propagation to the ios

the ios developer has said its because the swiper hasn't rendered the next slider so the ios native event will be triggered but i think it also happens when the next slider exists

can anyone help?

import { Swiper, SwiperSlide, useSwiper } from 'swiper/react';
import 'swiper/css';
import 'swiper/css/autoplay';

    <Swiper
      modules={[Autoplay]}
      slidesPerView={1}
      autoplay={{ delay: 1000, disableOnInteraction: false }}
      loop={true}
      className={styles.container}
    >
      {bannerData?.map(({ imageUrl }, index) => (
        <SwiperSlide
          key={`${imageUrl}-${index}`}
          className={styles.swiperSlide}
          onClick={() => onBannerClick(bannerData?.[index].webUrl ?? '')}
        >
          {/* ...Logging Event Code */}
          <BannerElement imageUrl={imageUrl} isLottie={checkIsLottieFileFormat(imageUrl)} />
          {/* ...Logging Event Code */}
        </SwiperSlide>
      ))}
      <SwiperFraction totalSlides={bannerData?.length ?? 0} />
    </Swiper>


css

.container {
  position: relative;
  width: 100%;
}

.swiperSlide {
  position: relative;
  cursor: pointer;
}

.swiperSlide .bannerElement {
  position: relative;
  aspect-ratio: 375 / 138;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.1) 100%),
    lightgray 50% / cover no-repeat;
}
ScreenRecording_01-06-2025.11-50-03_1.mov

Expected Behavior

Swipe only in the swiper container

Actual Behavior

the swiper container swipe doesnt work and the ios tab swipe works

Swiper version

11.2.0

Platform/Target and Browser Versions

ios 18

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
@Muscardinus94 Muscardinus94 changed the title Swiper Event Collision with safari webview in native Swiper Event Propagation with safari webview in native Jan 6, 2025
@nolimits4web
Copy link
Owner

Swiper doesn't conflict with native events, and what is a native event? Check swiper parameters to disable what you need

@Muscardinus94
Copy link
Author

Swiper doesn't conflict with native events, and what is a native event? Check swiper parameters to disable what you need

@nolimits4web
Native Event -> I was trying to say the mobile event(ios)
It works fine with Android webview, Web browser but it only cant swipe well with the ios webview
could you recommend any solutions such as disabling what parameters? Thanx for the quick reply

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

No branches or pull requests

2 participants