BugiDev / react-native-calendar-strip

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

put selected date in componentDidUpdate #228

Closed auliakbarh closed 3 years ago

peacechen commented 4 years ago

Thanks @auliakbarh for this PR. I made some tweaks to reduce the redundant setLocale() call, and also fix a bug due to Moment startOf() mutating the original date. https://momentjs.com/docs/#/manipulating/start-of/

This PR will cause the week to move to the selected date's ISO week. That behavior works for the case where useIsoWeekday is true. However it will be wrong if the user sets that to false. It should advance state.startingDate to the week that contains the new selectedDate. Another corner case is if both props startingDate and selectedDate change together. The selectedDate update would need to use the new prop value of startingDate instead of from state.

peacechen commented 3 years ago

@auliakbarh Many changes in commit fba1f3d are tab differences. Please run the linter and remove the tab-only changes. It's unnecessary and makes it difficult to see the true functional changes.

peacechen commented 3 years ago

This feature was added in another PR