react-awesome-slider icon indicating copy to clipboard operation
react-awesome-slider copied to clipboard

programmatically navigate slides?

Open robsilva opened this issue 4 years ago • 3 comments

Is there an API to programmatically allow me to advance or go back slides? How might one go about doing that? The slide arrow button seem to be dynamically added by the plugin, so I can't really put a ref on them, can I?

robsilva avatar Jun 17 '21 18:06 robsilva

@robsilva You could use the selected prop of <AwesomeSlider> to navigate between slides.

itsdwizzy avatar Sep 28 '21 18:09 itsdwizzy

While this works, I run into the error myself where if changing the selected prop/attribute before the transitioning has completed from the previous change the slider will not update to reflect the new selected slider value. Has anyone figured out a strategy in handling this problem?

ghost avatar Oct 12 '21 18:10 ghost

While this works, I run into the error myself where if changing the selected prop/attribute before the transitioning has completed from the previous change the slider will not update to reflect the new selected slider value. Has anyone figured out a strategy in handling this problem?

@jakermate Hi. Did you try to make use of onTransitionStart & onTransitionEnd props? First one is fired when you request slide change and second when transition ends. You could mix that with some boolean value that would disable button unless transition ends? :)

For more details check #185 and https://github.com/rcaferati/react-awesome-slider#main-props.

trolit avatar Oct 26 '21 22:10 trolit