react-swipeable-views
react-swipeable-views copied to clipboard
Wrong issue calculation in Virtualize, when changing over big ranges backwards (e.g. 100 -> 0)
If you'll change index from 100 to 0, the setIndex function which is called from componentWillReceiveProps will return wrong results:
https://github.com/oliviertassinari/react-swipeable-views/blob/master/packages/react-swipeable-views-utils/src/virtualize.js#L34
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
Steps to Reproduce (for bugs)
this.setIndex(index, this.state.indexContainer + indexDiff, indexDiff);
where:
index = 0
indexContainer = 2
indexDiff = -99
slideCount = 100
Current Behavior
setState called with the following object:
{
index: 0,
indexContainer: 0,
indexStart: 0,
indexStop: 99,
}
Expected Behavior
setState called with the following object:
{
index: 0,
indexContainer: 0,
indexStart: 0,
indexStop: 2,
}