Skip to content

Commit

Permalink
Merge pull request wix#1483 from wix/fixPassingMarkedDates
Browse files Browse the repository at this point in the history
Fix the markedDates we pass to WeekCalendar
  • Loading branch information
ethanshar authored May 4, 2021
2 parents 6fd5e20 + 2effaae commit b3a8cd9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/expandableCalendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class ExpandableCalendar extends Component {
return days.length / 7;
}

// TODO: this logic repeat itself in WeekCalendar - consider moving to a presenter
getMarkedDates() {
const {context, markedDates} = this.props;

Expand Down Expand Up @@ -438,8 +439,9 @@ class ExpandableCalendar extends Component {

renderWeekCalendar() {
const {position} = this.state;
const {disableWeekScroll} = this.props;
const {disableWeekScroll, markedDates: propsMarkedDates} = this.props;
const WeekComponent = disableWeekScroll ? Week : WeekCalendar;
const markedDates = disableWeekScroll ? this.getMarkedDates() : propsMarkedDates;

return (
<Animated.View
Expand All @@ -451,7 +453,7 @@ class ExpandableCalendar extends Component {
{...this.props}
current={this.props.context.date}
onDayPress={this.onDayPress}
markedDates={this.getMarkedDates()} // for Week component
markedDates={markedDates} // for Week component
style={this.props.calendarStyle}
allowShadow={false}
hideDayNames={true}
Expand Down

0 comments on commit b3a8cd9

Please sign in to comment.