File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments