-
Notifications
You must be signed in to change notification settings - Fork 21
Expose setSlide function #100
Comments
Hey @hyochan, thanks for your input. We allready thought about this and you can set the active slide with the activeIndex prop For example const foo = () => {
const [sliderIndex, setSliderIndex] = useState(0)
return (
<button onClick={() => setSliderIndex(2)}>Move to third slide</button>
<Slider activeIndex={sliderIndex}>
<MySlide />
<MySlide />
<MySlide />
</Slider>
)} |
@Tobi-mmt Thanks for the feedback. I"ve already tried that but that only works at the initial state. When you swipe children around and call |
That should be that story, right? What do you mean by "swipe children around" exactly? |
Sorry that I've not made it clear. To be specific, I want to tell you what I'm trying to build today. If I use below code with Also, it'd be good if we can set index sometimes without animation and sometimes with animation. |
@mstruebing Would above make you clear now? Please tell me if anything isn't clear! Thanks. |
Ah I can reproduce what you mean. It seems that this is indeed not working and it is a bug in my opinion so we should fix it. |
I added the ability to add a property |
* test: Add test for activeIndex manipulating onSlideChange * feat: Add optionally custom `setSlide` function closes #100 * docs: Add `setSlideCustom` to changelog * docs: Add `setSlideCustom` to readme * Update README.md Co-authored-by: Tobias <tobi.l@posteo.at> Co-authored-by: Tobias <tobi.l@posteo.at>
🎉 This issue has been resolved in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Could you expose
setSlide
method in here?I'd like to manually slide even without dragging by clicking on the element outside the div.
Hope this could be applied soon or I'd like to fork this repo and use for myself :)
Thanks for all the work in advance.
The text was updated successfully, but these errors were encountered: