react-native-snap-carousel icon indicating copy to clipboard operation
react-native-snap-carousel copied to clipboard

autoplay failed.

Open jungleyu opened this issue 9 years ago • 15 comments

When I set autoplay to true, it just slide to next item and then stopped

jungleyu avatar Sep 14 '17 11:09 jungleyu

Have you tried version 3.2.1? It should fix this issue introduced in 3.2.0. Can you confirm that it works as expected?

bd-arc avatar Sep 14 '17 12:09 bd-arc

It works well on version 3.2.1, thank you!

jungleyu avatar Sep 15 '17 01:09 jungleyu

I still have problems with auto play on android with 3.2.1 version.

albertosgr avatar Sep 18 '17 09:09 albertosgr

Did you take a look at this note from the doc?

bd-arc avatar Sep 18 '17 10:09 bd-arc

Autoplay fails when enableMomentum = true. If I set it to false, its working. Let me do some more tests on it, since its binded with a pagination control with tap enabled (autoplay + tap on pagination)

albertosgr avatar Sep 18 '17 10:09 albertosgr

Oh, you might be onto something: with the new callback mechanism, I may have forgotten to handle everything properly when enableMomentum is set to true... I'll shortly take a look at it.

bd-arc avatar Sep 18 '17 10:09 bd-arc

@albertosgr Indeed, I did make a mistake while refactoring. This commit fixes the issue ;-)

bd-arc avatar Sep 18 '17 14:09 bd-arc

@albertosgr The fix is available in version 3.2.2 ;-)

bd-arc avatar Sep 18 '17 17:09 bd-arc

Thank you.

albertosgr avatar Sep 19 '17 14:09 albertosgr

Thank you for the great work!

I am using 3.3.3 now, but I am having issues of using autoplay along with loop (enableMomentum is set to false). The behavior is when it first starts to autoplay after 5 seconds of default delay, it starts to with a blank/white view, and if you start to scroll, it starts to jump around. You will need to scroll a few times until it works properly. If I disable loop, then everything works great.

Any idea on this?

lichenglu avatar Oct 17 '17 01:10 lichenglu

Hmm...briefly went through the code of carousel. It seems the issue I mentioned has something to do with _getFirstItem. As when loop is enabled, the first item returned is index + loopClonesPerSide. If I adjust the firstItem prop to be sliderFirstItem - loopClonesPerSide where loopClonesPerSide is smaller than data's length, then things work out fine. @bd-arc

lichenglu avatar Oct 17 '17 02:10 lichenglu

Hi @lichenglu,

I haven't been able to reproduce the issue you describe. Can you try to build the provided example? The first carousel in it uses both autoplay and loop, and it works flawlessly on every device I've tested it on.

In the meantime, can you also give version 3.3.4 a try? It fixes an issue that sometimes arise when loopClonesPerSide is greater than data length.

bd-arc avatar Oct 17 '17 08:10 bd-arc

auto play for when I touch an image and scroll the screen, any help on the problem?

meedwire avatar Mar 06 '20 02:03 meedwire

scroll screen disable autoplay

sridix avatar Aug 04 '21 07:08 sridix

In order to work autoplay, you need loop and enableSnap props set to be true besides autoplay.

wahas-mughal avatar Aug 12 '21 16:08 wahas-mughal