Skip to content

Commit

Permalink
[TimePicker] Move state props access into componentWillMount for IE9/10
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaidar committed Jul 4, 2016
1 parent 2f20908 commit 782eaeb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/TimePicker/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ class Clock extends Component {
};

state = {
selectedTime: this.props.initialTime || new Date(),
selectedTime: null,
mode: 'hour',
};

componentWillMount() {
this.setState({
selectedTime: this.props.initialTime,
});
}

setMode = (mode) => {
setTimeout(() => {
this.setState({
Expand Down
8 changes: 7 additions & 1 deletion src/TimePicker/ClockPointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ class ClockPointer extends Component {
};

state = {
inner: isInner(this.props),
inner: false,
};

componentWillMount() {
this.setState({
inner: isInner(this.props),
});
}

componentWillReceiveProps(nextProps) {
this.setState({
inner: isInner(nextProps),
Expand Down
8 changes: 7 additions & 1 deletion src/TimePicker/TimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,16 @@ class TimePicker extends Component {
};

state = {
time: this.isControlled() ? this.getControlledTime() : this.props.defaultTime,
time: null,
dialogTime: new Date(),
};

componentWillMount() {
this.setState({
time: this.isControlled() ? this.getControlledTime() : this.props.defaultTime,
});
}

componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({
Expand Down

0 comments on commit 782eaeb

Please sign in to comment.