Skip to content

Commit

Permalink
fix: auto scroll on event selection (jquense#2235)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukbak committed Jul 19, 2022
1 parent 209de9b commit 6d87ebb
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/TimeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default class TimeGrid extends Component {
}

getSnapshotBeforeUpdate() {
this.calculateScroll()
this.checkOverflow()
return null
}
Expand All @@ -36,6 +35,8 @@ export default class TimeGrid extends Component {
if (this.props.width == null) {
this.measureGutter()
}

this.calculateScroll()
this.applyScroll()

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

applyScroll() {
// If auto-scroll is disabled, we don't actually apply the scroll
if (
!this.props.selected &&
this._scrollRatio != null &&
this.props.enableAutoScroll === true
) {
if (this._scrollRatio != null && this.props.enableAutoScroll === true) {
const content = this.contentRef.current
content.scrollTop = content.scrollHeight * this._scrollRatio
// Only do this once
Expand Down

0 comments on commit 6d87ebb

Please sign in to comment.