Skip to content

Commit 8766d63

Browse files
committed
Merge pull request #146 from renanvalentin/master
Checking if the component is mounted before perfom some animation
2 parents 26ebab5 + c71a974 commit 8766d63

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/js/floating-action-button.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ var RaisedButton = React.createClass({
6767
//animate the zdepth change
6868
this.setState({ zDepth: this.state.initialZDepth + 1 });
6969
setTimeout(function() {
70-
this.setState({ zDepth: this.state.initialZDepth });
70+
if (this.isMounted()) {
71+
this.setState({zDepth: this.state.initialZDepth});
72+
}
7173
}.bind(this), 450);
7274
}
7375

7476
});
7577

76-
module.exports = RaisedButton;
78+
module.exports = RaisedButton;

0 commit comments

Comments
 (0)