react-native-pager-view
react-native-pager-view copied to clipboard
Any plan or easy implementation for infinite/endless loop?
Watching this wrapper for a long time and used in so many projects. However, still couldn't find a way to implement infinite loop. Any suggestions?
There is a optional solution which is mentioned in https://github.com/callstack/react-native-pager-view/issues/196
Defined Pages:
Origin: ['Page1', 'Page2', 'Page3'],
New: ['Page3', 'Page1', 'Page2', 'Page3', 'Page1']
How it works:
When scroll to New[4] (Page1)
, invoke setPageWithoutAnimation(1)
When scroll to New[0] (Page3)
, invoke setPageWithoutAnimation(3)
I had achieved infinite/endless loop in this way in pure react native level, But it does't work very well, there are some small issues, like rendering, animation, etc. Anyway, this solution is used in our release production for now. And I think it's better to do it in the native level but not JavaScript.