voronianski/react-swipe

whether or not support config "pagination"?

hd996 opened this issue · 5 comments

hd996 commented

Description

I want to show the pagination,but I don't find the config

There is callback on swipeOptions which returns the index - would that not suffice for what you are trying to achieve?

@Cyberlane When I attempt to setState in the callback the swiping functionality breaks. I want to store the index in react state but any reference to state, even one completely unrelated to the ReactSwipe component breaks things. Any ideas?

@david-bishop-levelstudio as soon as you set the state, you are forcing a re-render of the component which makes it render the set index (defaults to 0) again. So the only way for you to realistically make that would, you would need to set the index to the same as what you have stored in state, and initialize your state to 0.

As far as I can tell, this issue is resolved. If anybody has any further contributions to it, I would be happy to re-open it.

Just wanted to point out how you can fix it without rerenders. Add in swipeOptions property startSlide. Property value should be your current page.