diff --git a/src/FocusedSkin.js b/src/FocusedSkin.js index 2e031aa8..8797697f 100644 --- a/src/FocusedSkin.js +++ b/src/FocusedSkin.js @@ -39,21 +39,6 @@ class FocusedSkin extends React.Component { } this._webampLoadedEvents = new Subject(); this._transitionBeginEvents = new Subject(); - } - - componentDidMount() { - if (!this.props.centered) { - this._disposable.add( - timer(0).subscribe(() => { - // TODO: Observe DOM and recenter - this.setState(this._getCenteredState()); - this._transitionBeginEvents.next(null); - }) - ); - } else { - this._transitionBeginEvents.next(null); - } - const transitionComplete = this._transitionBeginEvents.pipe(delay(500)); // Emit after both Webamp has loaded, and the transition is complete @@ -78,6 +63,20 @@ class FocusedSkin extends React.Component { ); } + componentDidMount() { + if (!this.state.centered) { + this._disposable.add( + timer(0).subscribe(() => { + // TODO: Observe DOM and recenter + this.setState(this._getCenteredState()); + this._transitionBeginEvents.next(null); + }) + ); + } else { + this._transitionBeginEvents.next(null); + } + } + componentWillUnmount() { this._disposable.dispose(); }