diff --git a/example/src/ProgressBarExample.js b/example/src/ProgressBarExample.js index 368d8a2..2e3f2b0 100644 --- a/example/src/ProgressBarExample.js +++ b/example/src/ProgressBarExample.js @@ -9,17 +9,41 @@ type Props = { theme: Theme, }; -class ProgressBarExample extends React.Component { +type State = { + progress: number, +}; + +class ProgressBarExample extends React.Component { static title = 'Progress bar'; + state = { + progress: 0, + }; + + componentDidMount() { + this._interval = setInterval( + () => + this.setState(state => ({ + progress: state.progress < 1 ? state.progress + 0.01 : 0, + })), + 16 + ); + } + + componentWillUnmount() { + clearInterval(this._interval); + } + + _interval: any; + render() { const { theme: { colors: { background } } } = this.props; return ( ProgressBar primary color - + ProgressBar custom color - + ); }