Skip to content

Commit

Permalink
Merge pull request #3786 from niktechnopro/offsetTopCrashFix-2
Browse files Browse the repository at this point in the history
Offset top crash fix 2
  • Loading branch information
martijnrusschen committed Nov 22, 2022
2 parents 6249501 + dc1931a commit 4a8caf0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/time.jsx
Expand Up @@ -62,12 +62,14 @@ export default class Time extends React.Component {

componentDidMount() {
// code to ensure selected time will always be in focus within time window when it first appears
this.list.scrollTop = Time.calcCenterPosition(
this.props.monthRef
? this.props.monthRef.clientHeight - this.header.clientHeight
: this.list.clientHeight,
this.centerLi
);
this.list.scrollTop =
this.centerLi &&
Time.calcCenterPosition(
this.props.monthRef
? this.props.monthRef.clientHeight - this.header.clientHeight
: this.list.clientHeight,
this.centerLi
);
if (this.props.monthRef && this.header) {
this.setState({
height: this.props.monthRef.clientHeight - this.header.clientHeight,
Expand Down

0 comments on commit 4a8caf0

Please sign in to comment.