Skip to content

Commit a45db87

Browse files
PaulRBergmartijnrusschen
authored andcommitted
Fix the time container whitespace issue (Hacker0x01#1717)
1 parent 337e464 commit a45db87

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/time.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ export default class Time extends React.Component {
4343
);
4444
};
4545

46+
state = {
47+
height: null
48+
}
49+
4650
componentDidMount() {
4751
// code to ensure selected time will always be in focus within time window when it first appears
4852
this.list.scrollTop = Time.calcCenterPosition(
@@ -51,6 +55,11 @@ export default class Time extends React.Component {
5155
: this.list.clientHeight,
5256
this.centerLi
5357
);
58+
if (this.props.monthRef && this.header) {
59+
this.setState({
60+
height: this.props.monthRef.clientHeight - this.header.clientHeight
61+
});
62+
}
5463
}
5564

5665
handleClick = time => {
@@ -143,10 +152,7 @@ export default class Time extends React.Component {
143152
};
144153

145154
render() {
146-
let height = null;
147-
if (this.props.monthRef && this.header) {
148-
height = this.props.monthRef.clientHeight - this.header.clientHeight;
149-
}
155+
const { height } = this.state;
150156

151157
return (
152158
<div

0 commit comments

Comments
 (0)