Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TimerMixin on ProgressBarAndroidExample.android.js #21501

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions RNTester/js/ProgressBarAndroidExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ var createReactClass = require('create-react-class');
var RNTesterBlock = require('RNTesterBlock');
var RNTesterPage = require('RNTesterPage');

var TimerMixin = require('react-timer-mixin');

var MovingBar = createReactClass({
displayName: 'MovingBar',
mixins: [TimerMixin],
_intervalID: (null: ?IntervalID),

getInitialState: function() {
return {
Expand All @@ -29,12 +27,18 @@ var MovingBar = createReactClass({
},

componentDidMount: function() {
this.setInterval(() => {
this._intervalID = setInterval(() => {
var progress = (this.state.progress + 0.02) % 1;
this.setState({progress: progress});
}, 50);
},

componentWillUnmount: function() {
if (this._intervalID != null) {
clearInterval(this._intervalID);
}
},

render: function() {
return <ProgressBar progress={this.state.progress} {...this.props} />;
},
Expand Down