From 6173e9b4083eb9ec34e4a268db6c69d380a98080 Mon Sep 17 00:00:00 2001 From: rodik Date: Fri, 19 Feb 2016 15:43:29 +0200 Subject: [PATCH] Clock SSR fix --- components/time_picker/Clock.jsx | 4 +++- components/time_picker/ClockHand.jsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/time_picker/Clock.jsx b/components/time_picker/Clock.jsx index eede27ec..b56e8efe 100644 --- a/components/time_picker/Clock.jsx +++ b/components/time_picker/Clock.jsx @@ -30,7 +30,9 @@ class Clock extends React.Component { componentDidMount () { window.addEventListener('resize', this.handleCalculateShape); - this.handleCalculateShape(); + setTimeout(() => { + this.handleCalculateShape(); + }); } componentWillUnmount () { diff --git a/components/time_picker/ClockHand.jsx b/components/time_picker/ClockHand.jsx index 6dea2f2c..a5d099e5 100644 --- a/components/time_picker/ClockHand.jsx +++ b/components/time_picker/ClockHand.jsx @@ -27,7 +27,9 @@ class Hand extends React.Component { }; componentDidMount () { - this.setState({knobWidth: this.refs.knob.offsetWidth}); + setTimeout(() => { + this.setState({knobWidth: this.refs.knob.offsetWidth}); + }); } getMouseEventMap () {