Ensure we don't doubletime the marquee when changing skins

This commit is contained in:
Jordan Eldredge 2017-09-11 17:24:42 -07:00
parent 277847f6ea
commit 4b33fb54c6

View file

@ -76,11 +76,12 @@ class Marquee extends React.Component {
this.state = { stepping: true, dragOffset: 0 };
this.handleMouseDown = this.handleMouseDown.bind(this);
this.getText = this.getText.bind(this);
this.stepHandle = null;
}
componentDidMount() {
const step = () => {
setTimeout(() => {
this.stepHandle = setTimeout(() => {
if (this.state.stepping) {
this.props.dispatch({ type: STEP_MARQUEE });
}
@ -92,6 +93,12 @@ class Marquee extends React.Component {
}
}
componentWillUnmount() {
if (this.stepHandle) {
clearTimeout(this.stepHandle);
}
}
getText() {
switch (this.props.userInput.focus) {
case "balance":