stephy / CalendarPicker

CalendarPicker Component for React Native
787 stars 369 forks source link

min and max Date change issue #384

Open DiligentMe opened 1 month ago

DiligentMe commented 1 month ago

When the minDate and MaxDate is changed, it remain on previous min-max Date. When i move to actual month (previous or next) it behaves abnormally. new min and MaxDate is newer than previous min max date, previous button stays active infinitely and same is the case with if minmax date is older than previous minmax date it next button keeps active. When i actually move to actual minmax date month it gets set to correct min max date range. <CalendarPicker allowRangeSelection={false} enableDateChange={false} restrictMonthNavigation={true} minDate={minDate} maxDate={maxDate} startFromMonday={true} showDayStragglers={true} disabledDates={disabled} customDatesStyles={allDates} /> please help to solve this problem!

peacechen commented 1 month ago

This sounds like a bug in the prop change detection @tranjog

It's time to refactor this to a function component with hooks. The prop comparison logic has gotten too complex and unmanageable.

DiligentMe commented 1 month ago

a little more precise update about the issue

  1. it scrolls to current month even if the new min max date doesn't include the current month when i use with a key to create fresh new calander, moving to actual month it gets corrected
  2. If i don't use key, it sticks to last month on screen and when i move to the actual month it gets corrected