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

Start and stop autoplay programatically

Open jpolack opened this issue 9 years ago • 6 comments

Hello everyone,

is it yet possible to start and stop autoplay programatically?

If not this might be a nice feature.

Thanks

jpolack avatar Aug 26 '16 06:08 jpolack

Hi,

You can bind swiper autoplay property your screen state on below.

<Swiper autoplay={this.state.swiperAutoPlay}

If you want to stop swiper at any time, just set the swiperAutoPlay value to false.

Good luck.

ermankuruoglu avatar Jul 02 '17 16:07 ermankuruoglu

@ermankuruoglu this method can stop autoplay,but can not start autoplay after stop

autume avatar Jul 19 '17 02:07 autume

Yes, it only works one way, because it kills the timer if the new props are "!autoplay". But it sets the timer only onScrollEnd, which never occurs automatically after it's stopped.

asgvard avatar Nov 02 '17 10:11 asgvard

Meanwhile you can use <Swiper ref={node => this.swiper = node} />. And after that this.swiper.autoplay()

ifours avatar Nov 14 '17 21:11 ifours

Meanwhile you can use <Swiper ref={node => this.swiper = node} />. And after that this.swiper.autoplay()

Does this solution works? It's not working in my case

romit07 avatar Jan 15 '19 13:01 romit07

just changed my autoplay state to null and vice versa

Osmon11 avatar Mar 01 '23 18:03 Osmon11