Skip to content

Commit

Permalink
Add prop highlightDateContainerStyle (#259, #261)
Browse files Browse the repository at this point in the history
Also fix weekend styling (was only applying if selected).

Co-authored-by: Döngölő Zsolt <[email protected]>
  • Loading branch information
dezse97 and dezse97 authored Jan 18, 2021
1 parent 8ea9452 commit 49ecc6f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ AppRegistry.registerComponent('Example', () => Example);
| **`styleWeekend`** | Whether to style weekend dates separately. | Bool | **`True`** |
| **`highlightDateNameStyle`** | Style for the selected name of the day in dates strip. | Any |
| **`highlightDateNumberStyle`** | Style for the selected number of the day in dates strip. | Any |
| **`highlightDateContainerStyle`** | Style for the selected date container. | Object |
| **`disabledDateNameStyle`** | Style for disabled name of the day in dates strip (controlled by datesWhitelist & datesBlacklist). | Any |
| **`disabledDateNumberStyle`** | Style for disabled number of the day in dates strip (controlled by datesWhitelist & datesBlacklist). | Any |
| **`markedDatesStyle`** | Style for the marked dates marker. | Object |
Expand Down
1 change: 1 addition & 0 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export default class App extends Component<{}> {
dateNameStyle={{color: 'white'}}
iconContainer={{flex: 0.1}}
customDatesStyles={this.state.customDatesStyles}
highlightDateContainerStyle={{backgroundColor: 'black'}}
markedDates={this.state.markedDates}
datesBlacklist={this.datesBlacklistFunc}
onDateSelected={this.onDateSelected}
Expand Down
4 changes: 3 additions & 1 deletion src/CalendarDay.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class CalendarDay extends Component {
daySelectionAnimation,
highlightDateNameStyle,
highlightDateNumberStyle,
highlightDateContainerStyle,
styleWeekend,
weekendDateNameStyle,
weekendDateNumberStyle,
Expand Down Expand Up @@ -398,7 +399,7 @@ class CalendarDay extends Component {
_customHighlightDateNameStyle = customStyle.highlightDateNameStyle;
_customHighlightDateNumberStyle = customStyle.highlightDateNumberStyle;
}
if (enabled && selected) {
if (enabled) {
// Enabled state
//The user can disable animation, so that is why I use selection type
//If it is background, the user have to input colors for animation
Expand Down Expand Up @@ -433,6 +434,7 @@ class CalendarDay extends Component {
];
}
if (selected) {
_dateViewStyle.push(highlightDateContainerStyle);
_dateNameStyle = [
styles.dateName,
highlightDateNameStyle,
Expand Down
2 changes: 2 additions & 0 deletions src/CalendarStrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class CalendarStrip extends Component {
weekendDateNumberStyle: PropTypes.any,
highlightDateNameStyle: PropTypes.any,
highlightDateNumberStyle: PropTypes.any,
highlightDateContainerStyle: PropTypes.any,
disabledDateNameStyle: PropTypes.any,
disabledDateNumberStyle: PropTypes.any,
markedDatesStyle: PropTypes.object,
Expand Down Expand Up @@ -423,6 +424,7 @@ class CalendarStrip extends Component {
weekendDateNumberStyle: this.props.weekendDateNumberStyle,
highlightDateNameStyle: this.props.highlightDateNameStyle,
highlightDateNumberStyle: this.props.highlightDateNumberStyle,
highlightDateContainerStyle: this.props.highlightDateContainerStyle,
disabledDateNameStyle: this.props.disabledDateNameStyle,
disabledDateNumberStyle: this.props.disabledDateNumberStyle,
markedDatesStyle: this.props.markedDatesStyle,
Expand Down

0 comments on commit 49ecc6f

Please sign in to comment.