Skip to content

Commit 6d87ebb

Browse files
authored
fix: auto scroll on event selection (jquense#2235)
Fixes jquense#2233
1 parent 209de9b commit 6d87ebb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/TimeGrid.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export default class TimeGrid extends Component {
2727
}
2828

2929
getSnapshotBeforeUpdate() {
30-
this.calculateScroll()
3130
this.checkOverflow()
3231
return null
3332
}
@@ -36,6 +35,8 @@ export default class TimeGrid extends Component {
3635
if (this.props.width == null) {
3736
this.measureGutter()
3837
}
38+
39+
this.calculateScroll()
3940
this.applyScroll()
4041

4142
window.addEventListener('resize', this.handleResize)
@@ -277,11 +278,7 @@ export default class TimeGrid extends Component {
277278

278279
applyScroll() {
279280
// If auto-scroll is disabled, we don't actually apply the scroll
280-
if (
281-
!this.props.selected &&
282-
this._scrollRatio != null &&
283-
this.props.enableAutoScroll === true
284-
) {
281+
if (this._scrollRatio != null && this.props.enableAutoScroll === true) {
285282
const content = this.contentRef.current
286283
content.scrollTop = content.scrollHeight * this._scrollRatio
287284
// Only do this once

0 commit comments

Comments
 (0)