Changing Autoplay via Props Doesn't Work Correctly
See original GitHub issueIssue Description
With the latest version of React-Slick, 0.14.6
, if we update a Carousel’s autoplay
property to false the carousel does one more slide before stopping autoplay. Then, if we update the autoplay
property again to true
the slider’s autoplay functionality no longer works.
Steps to Reproduce
- Navigate to this Fiddle (I updated the external react-slick dep to 0.14.6 and added a play/pause button that just updates the autoplay prop in settings).
- Observe that autoplay works. There are 4 different images to make this clearer.
- Click the
pause
button. Wait at least an additional 2000ms, and observe that the carousel does one more slide before stopping. - Now click the
play
button and observe that the carousel’s autoplay doesn’t start up again.
What Causes this bug?
This bug was introduced in https://github.com/akiran/react-slick/pull/526, when autoplay was changed from setInterval
to setTimeout
.
Fix
I forked the library and fixed this bug. I will submit a PR and reference this issue.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
reactjs - Video autoplay not working - Trying to find a fix
I have a video background in React. I want it to autoplay. Autoplay does not work. I have ...
Read more >Video Player Project React - Menu doesn't work
I can't change the video by using the menu buttons. ... ( <div> <video controls autostart autoPlay muted src={this.props.src} /> </div> ); }...
Read more >Settings - lightGallery
Name Type Default
addClass # string ""
allowMediaOverlap # boolean false
appendCounterTo # string ".lg‑toolbar"
Read more >Video - Expo Documentation
This page covers video-specific props and APIs. We encourage you to skim through this document to get basic video working, and then move...
Read more >React.js cheatsheet - Devhints
render () { this.props.fullscreen const { fullscreen, autoplay } = this.props ··· } ... And without constructor using Babel with proposal-class-fields.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Still doesn’t work.
It doesn’t work even in 0.25.2
quick hack:
idea from https://github.com/akiran/react-slick/pull/651#issuecomment-304287662