BugiDev / react-native-calendar-strip

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

If scrollable then setSelectedDate is not centering calendar #240

Closed majugurci closed 3 years ago

majugurci commented 3 years ago

If the scrollable property is set to true, method setSelectedDate will not reposition calendar so that selected date is in the view.

I have made 2 snacks which replicate this. When you click the button bellow the calendar it sets the new date. But if scrollable={true} then it wont reposition the calendar.

Snack with scrollable

Snack without scrollable

wroxer commented 3 years ago

same here

peacechen commented 3 years ago

Yes that is a bug in the scroller. PR #247 adds a scrollToDate method to the scroller that can be leveraged for this. Once that's merged, it should be simple to call that in setSelectedDate()

peacechen commented 3 years ago

Published in 2.1.1 Happy New Year 🎆

majugurci commented 3 years ago

Thank you, I have tested it and it works good now.