BugiDev / react-native-calendar-strip

Easy to use and visually stunning calendar component for React Native.
MIT License
933 stars 325 forks source link

Fixed numVisibleItems in Scroller component #280

Closed psolom closed 3 years ago

psolom commented 3 years ago

I got the case when numVisibleItems is calculated as 6 instead of 7 days and that is ruins paged scrollable. I found that before Math.floor() being applied the raw value is 6.94 which, I believe, is ok since it's calculated upon rounded itemWidth & marginHorizontal values. But when you floor the numVisibleItems itself it ends up in wrong days & unexpected paging behavior. This PR suggests to replace Math.floor() with Math.round()

I suppose it also could be a fix for issue #269

peacechen commented 3 years ago

Thanks @psolom 👍

psolom commented 3 years ago

sure, and take a look #279 please that's the only thing I need to solve before I can use your plugin in my app