Skip to content

Commit 4b68004

Browse files
committed
fixed bug on scrollToOnSetSelectedDate
1 parent a36ff77 commit 4b68004

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/CalendarStrip.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ class CalendarStrip extends Component {
565565
onWeekScrollStart={this.props.onWeekScrollStart}
566566
onWeekScrollEnd={this.props.onWeekScrollEnd}
567567
externalScrollView={this.props.externalScrollView}
568+
scrollToOnSetSelectedDate={this.props.scrollToOnSetSelectedDate}
568569
/>
569570
);
570571
}

src/Scroller.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ export default class CalendarScroller extends Component {
2525
onWeekScrollStart: PropTypes.func,
2626
onWeekScrollEnd: PropTypes.func,
2727
externalScrollView: PropTypes.func,
28-
pagingEnabled: PropTypes.bool
28+
pagingEnabled: PropTypes.bool,
29+
scrollToOnSetSelectedDate: PropTypes.bool
2930
}
3031

3132
static defaultProps = {
3233
data: [],
3334
renderDayParams: {},
35+
scrollToOnSetSelectedDate: true
3436
};
3537

3638
constructor(props) {
@@ -128,6 +130,8 @@ export default class CalendarScroller extends Component {
128130

129131
// Scroll to given date, and check against min and max date if available.
130132
scrollToDate = (date) => {
133+
if (!this.props.scrollToOnSetSelectedDate) return;
134+
131135
let targetDate = moment(date).subtract(Math.round(this.state.numVisibleItems / 2) - 1, "days");
132136
const {
133137
minDate,

0 commit comments

Comments
 (0)