leecade / leecade/react-native-swiper

滑动的时候能否阻止自动播放,不滑动恢复轮播

Open
#952 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

hi,
目前使用react-native-swiper1.5.14版本

手势滑动轮播,轮播没有管手势,照常轮播。

之前使用轮播组件或者(swiper)的时候,autoplay loop之后,手势放上去,会停止轮播,移开又会自动轮播,目前这个如何实现呢?

我用如下实现了
Swiper autoplay ={this.state.autoplay}

_onTouchStart=() => { // swiper 开始touch的时候停止autoplay this.setState({// 会触发多次渲染,关闭不用 autoplay: false }) // console.log(this.state.autoplay) } _onTouchEnd=() => { // swiper低版本无效,依赖crn-ext高版本 this.setState({// 会触发多次渲染,关闭不用 autoplay: true }) }

但是导致swiper会不停的重新渲染,影响性能?

这边有什么参数可以设置吗?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Swiper autoplay prop and the _onTouchStart/_onTouchEnd callbacks described in the issue; inspect how touch events interact with autoplay. Done means autoplay pauses while the user swipes and resumes afterward without repeated costly rerenders.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.