import React from 'react';

export default class LoadingText extends React.Component {
  waitTimeout = null;

  state = {
    text: null
  };

  componentDidMount() {
    this.waitTimeout = setTimeout(() => {
      this.setState({
        text: this.props.text || 'Loading...'
      });
    }, this.props.showAfter || 250);
  }

  componentWillUnmount() {
    clearTimeout(this.waitTimeout);
  }

  render() {
    if (!this.state.text) {
      return null;
    }

    return (
      <p style={{ textAlign: 'center' }} classNames={ this.props.classNames }>
        { this.props.children ? this.props.children : this.state.text }
      </p>
    );
  }
}

@@ -478,16 +478,32 @@
       %3Cp
+ %7B...this.props%7D
  style=%7B
@@ -530,45 +530,8 @@
 ' %7D%7D
- classNames=%7B this.props.classNames %7D
 %3E%0A  

fix issue with providing custom props to the LoadingText component