Skip to content

Commit 0e24180

Browse files
author
Tautvilas Mečinskas
authored
Merge pull request wix#628 from entria/fix/hideExtraDays
fix(calendar): always use flex: 1 to fix hideExtraDays={true} not wor…
2 parents 30e93f5 + a543339 commit 0e24180

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

src/calendar/index.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Calendar extends Component {
4141
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
4242
firstDay: PropTypes.number,
4343

44-
// Date marking style [simple/period/multi-dot/multi-period]. Default = 'simple'
44+
// Date marking style [simple/period/multi-dot/multi-period]. Default = 'simple'
4545
markingType: PropTypes.string,
4646

4747
// Hide month navigation arrows. Default = false
@@ -166,31 +166,26 @@ class Calendar extends Component {
166166
} else if (dateutils.sameDate(day, XDate())) {
167167
state = 'today';
168168
}
169-
let dayComp;
169+
170170
if (!dateutils.sameMonth(day, this.state.currentMonth) && this.props.hideExtraDays) {
171-
if (['period', 'multi-period'].includes(this.props.markingType)) {
172-
dayComp = (<View key={id} style={{flex: 1}}/>);
173-
} else {
174-
dayComp = (<View key={id} style={this.style.dayContainer}/>);
175-
}
176-
} else {
177-
const DayComp = this.getDayComponent();
178-
const date = day.getDate();
179-
dayComp = (
180-
<DayComp
181-
key={id}
182-
state={state}
183-
theme={this.props.theme}
184-
onPress={this.pressDay}
185-
onLongPress={this.longPressDay}
186-
date={xdateToData(day)}
187-
marking={this.getDateMarking(day)}
188-
>
189-
{date}
190-
</DayComp>
191-
);
171+
return (<View key={id} style={{flex: 1}}/>);
192172
}
193-
return dayComp;
173+
174+
const DayComp = this.getDayComponent();
175+
const date = day.getDate();
176+
return (
177+
<DayComp
178+
key={id}
179+
state={state}
180+
theme={this.props.theme}
181+
onPress={this.pressDay}
182+
onLongPress={this.longPressDay}
183+
date={xdateToData(day)}
184+
marking={this.getDateMarking(day)}
185+
>
186+
{date}
187+
</DayComp>
188+
);
194189
}
195190

196191
getDayComponent() {

0 commit comments

Comments
 (0)