react-swipeable-views icon indicating copy to clipboard operation
react-swipeable-views copied to clipboard

Virtualize HoC should also update on slideCount changes

Open SleepWalker opened this issue 7 years ago • 0 comments

Currently Virtualize will recalculate the window only on index change, but there may be the cases, when slideCount changes dynamically. If in such case we will be on slides edge, we will get the badly calculated window.

https://github.com/oliviertassinari/react-swipeable-views/blob/master/packages/react-swipeable-views-utils/src/virtualize.js#L29

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior

if we'll render Virtualize with the following props:

<Virtualize
  index={0}
  slideCount={1}
  overscanSlideAfter={2}
  overscanSlideBefore={2}
/>

we will get only one slide rendered.

if we then change slideCount to e.g. 10, the two remaining slides won't be loaded

Expected Behavior

after increasing slideCount, the window should be recalculated and the remaining two pages should be rendered.

SleepWalker avatar Sep 27 '18 09:09 SleepWalker