Closed tiagomota79 closed 3 years ago
Another related issue:
Carousel stop rolling after a few stops on custom button using activeIndex
- video below (the number above Previous/Next buttons are the active index. Arrows are default.
https://user-images.githubusercontent.com/45611789/104028259-81d38780-5196-11eb-9805-6070fd9cbae0.mp4
Hi, @tiagomota79! So, it's how React works. You create new props (stories && responsive
) every time in the render
. As a result, the gallery getting new props every time reset or recaclulate inner state . As a solution, save props in the local state or use a code from examples(all of them use TypeScript
under hood): activeIndex, refs.
This issue has been mentioned before, but I was unable to get it working - the examples linked in the closed issues doesn't lead to the right place.
I'm trying to set custom arrows, but can't access the
slidePrev
andslideNext
methods. Trying to useactiveIndex
works but I loose the smooth animation - see video below, showing default arrows vs custom buttons withactiveIndex
.https://user-images.githubusercontent.com/45611789/104020650-88103680-518b-11eb-9b2e-07016d0a0399.mp4
Neither
ref
norprops
are working for me - maybe because I'm using Typescript? The code below gets custom buttons to work, but without the animation.What am I missing?