brainhubeu / react-carousel

A pure extendable React carousel, powered by Brainhub (craftsmen who ❤️ JS)
https://brainhub.eu/
MIT License
1.07k stars 164 forks source link

Carousel scrolls by itself when re-rendered, using infinite option #667

Open sudravi opened 3 years ago

sudravi commented 3 years ago

Describe the bug The CodeSandbox below demonstrates the problem. It has two tabs, one with Carousel and one blank. If you switch between tabs, you'll notice the tab with Carousel scrolls by itself when it's re-rendered. This only happens with the infinite option enabled.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/react-carousel-forked-y5ii2
  2. Click on 'Tab2' and click back to 'Tab1'
  3. See scrolling behavior

Expected behavior Don't expect any scrolling to happen by itself.

Screenshots None

Environment

takeshi-evan commented 3 years ago

Same problem here