react-native-web-swiper icon indicating copy to clipboard operation
react-native-web-swiper copied to clipboard

Swiper is Laggy on Mobile phones

Open vrinch opened this issue 4 years ago • 2 comments

The swiper works very well on desktop browsers, but gets laggy on some mobile phones, while on some, it does not show up at all

vrinch avatar Feb 12 '21 11:02 vrinch

@vrinch we don't need more information obviously we will help you. Just kidding, what phones ? What code ? Do you have a snack we can use to reproduce?

kopax-polyconseil avatar Feb 12 '21 12:02 kopax-polyconseil

You can use props passed into each slide to determine the logic inside it should be run or not here By default Swiper tries to render all the element, by returning null in some invisible item can improve performance.

type PageProps = {
  index?: number;
  activeIndex?: number;
} & ChapterPage;

export const Page: React.FC<PageProps> = ({index, activeIndex, ...page}) => {
  if (
    index &&
    activeIndex &&
    index !== activeIndex
  ) {
    return null;
  }
  return (
  // rest of the heavy logic of the slide
  )
}

hohoaisan avatar Feb 14 '22 16:02 hohoaisan

The issue seems to be stale. Please re-open if this is still needed, thanks.

jarvisluong avatar Oct 02 '22 12:10 jarvisluong