mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-22 19:48:56 +08:00
Remove TimerMixin on ProgressBarAndroidExample.android.js (#21501)
Summary: Related to #21485. Removed TimerMixin from the `RNTester/js/ProgressBarAndroidExample.android.js` since it is currently not used. - [x] npm run prettier - [x] npm run flow-check-ios - [x] npm run flow-check-android In progress 🙇 [GENERAL] [ENHANCEMENT] [RNTester/js/ProgressBarAndroidExample.android.js] - remove TimerMixin dependency Pull Request resolved: https://github.com/facebook/react-native/pull/21501 Reviewed By: TheSavior Differential Revision: D10218375 Pulled By: RSNara fbshipit-source-id: c4c12f65855452bc2485f034a0560afd204512f4
This commit is contained in:
committed by
Facebook Github Bot
parent
3aa8f09b44
commit
3d31bebbeb
@@ -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 {
|
||||
@@ -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} />;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user