In my case the slides are dynamic, so I need to return to the index 0 to avoid getting stuck in a position that no longer exists.
To solve it temporarily in my fork I exposed a resetIndex method on swipr:
function resetIndex () {
config.options.index = 0;
slide(false);
}
return {
resetIndex: resetIndex,
next: next,
prev: prev
};
And then I pass a prop to the React component so it knows when to reset:
componentDidUpdate: function() {
if (this.props.resetIndex) { this.swipr.resetIndex(); }
},
Please let me know if you think there's a better way of solving that or whether I can PR it.
In my case the slides are dynamic, so I need to return to the index 0 to avoid getting stuck in a position that no longer exists.
To solve it temporarily in my fork I exposed a resetIndex method on swipr:
And then I pass a prop to the React component so it knows when to reset:
Please let me know if you think there's a better way of solving that or whether I can PR it.