react-native-viewpager-carousel icon indicating copy to clipboard operation
react-native-viewpager-carousel copied to clipboard

Dynamic lazyrenderThreshold

Open KeithM23 opened this issue 7 years ago • 0 comments

Hi, thanks for the awesome library.

I just have a small issue, possibly a very small use case for this but I need the lazyrenderThreshold value to trigger each/the necessary pages _shouldPageRender methods.

I'm currently dynamically changing the lazyrenderThreshold value but unfortunately it's not causing the _shouldPageRender method on the pages to fire as the only thing that triggers this is onPageChange.

So for example if I have the lazyrenderThreshold set to 0, then i change it to 5, without changing the page(i.e. swiping etc..), no lazy rendering occurs. However when I do change the page the other pages start to lazy load as onPageChange triggers _shouldPageRender

Unfortunately I need this to happen without a page change so the above isn't okay for my use case. I tried to implement this in hopes of doing a PR but can't workout how to best implement it.

What I have works but is definitely a dirty/hacky way of doing this so don't want to do a PR with it.

I'm just calling _onMomentumScrollEnd (as it calls onPageChange on each of the pages) whenever the lazyrenderThreshold changes which works but isn't great.

Thanks again for the awesome library!

KeithM23 avatar Jun 30 '18 10:06 KeithM23