Skip to content

Commit 3c25009

Browse files
idanwejquense
authored andcommitted
fix: prevent un/mounting of date components (jquense#1276)
I wanted to make a transition to date elements when they were selected, releasing that a couldn't get the `transition` property working. After some digging to my code and react-big-calendar code, I found that after selecting a date `DateContentRow` un&mount their children components. This happens due to the call of [this](https://github.com/intljusticemission/react-big-calendar/blob/master/src/DateContentRow.js#L121) `renderDummy` happens after setting `needLimitMeasure` to true in `Month.jsx` after the date is changed. ---------------------------- Prevent re-mount of DateContentRow children when date change in the same month * Prevent setting `needLimitMeasure` to true when the month of the date is not changed, in order to prevent unmounting and mounting of all the weeks' components. * Make it possible to add transition to the background of the event when implementing selection of date within the calendar.
1 parent 9332ab7 commit 3c25009

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Month.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class MonthView extends React.Component {
3636

3737
componentWillReceiveProps({ date }) {
3838
this.setState({
39-
needLimitMeasure: !dates.eq(date, this.props.date),
39+
needLimitMeasure: !dates.eq(date, this.props.date, 'month'),
4040
})
4141
}
4242

@@ -274,7 +274,7 @@ class MonthView extends React.Component {
274274
end: slots[slots.length - 1],
275275
action: slotInfo.action,
276276
bounds: slotInfo.bounds,
277-
box: slotInfo.box
277+
box: slotInfo.box,
278278
})
279279
}
280280

0 commit comments

Comments
 (0)