stephy / CalendarPicker

CalendarPicker Component for React Native
807 stars 372 forks source link

Selected date styling #388

Closed jantrubka closed 2 months ago

jantrubka commented 4 months ago

Would it be possible for a selected day style to check whether it is also a custom date or today and merge those styles. It is applicable when for example selected day has a border and should keep a background color of today or custom date

jantrubka commented 4 months ago

I am new to github so don't know how to edit this repo but what I have written can be achieved by editing line 162 in Day.js to computedSelectedDayStyle = [ isToday && styles.selectedToday, custom.style, styles.selectedDay, ];

peacechen commented 4 months ago

Hello @jantrubka . Thanks for identifying the code change. To contribute to this project, fork the repo, commit your changes, and create a Pull Request.

Modifying the styles behavior could be break users who expect the existing behavior. A new prop would be needed to control whether to merge custom styles to Today. For example, mergeCustomStyleSelectedToday. That may not be necessary at all though. Could you manually merge the styles into selectedDayStyle?

jantrubka commented 4 months ago

If you mean manually merging the styles in my App, that would be quite difficult for me since the style may be different for each date and it may be changed by the user in a way. However I believe that my proposal would not disrupt anyone's code because the styles.selectedDay style is still the main one and overwrites the other two. Correct me if I am wrong ;)