Avoid case where random skin selection would cause webamp to jump when rendred

This commit is contained in:
Jordan Eldredge 2018-12-20 18:48:49 -08:00
parent 7808e91d34
commit d0541b7875

View file

@ -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();
}