Removing TimerMixin on ProgressViewIOSExample (#21500)

Summary:
Related to #21485.
Removed TimerMixin from the `RNTester/js/ProgressViewIOSExample.js` screen since it is currently not used.

- [x] `npm run prettier`
- [x] `npm run flow-check-ios`
- [x] `npm run flow-check-android`
- [x] runtime tests using `ProgressViewIOSExample` on Android and iOS

**RNTester steps**

- [x] Run RNTester.
- [x] Navigate to `ProgressViewIOSExample` and check if the animations are executed correctly and without lag.

[GENERAL] [ENHANCEMENT] [RNTester/js/ProgressViewIOSExample.js] - remove TimerMixin dependency
Pull Request resolved: https://github.com/facebook/react-native/pull/21500

Reviewed By: TheSavior

Differential Revision: D10218366

Pulled By: RSNara

fbshipit-source-id: b44a0bbb50f6b0e85f406904131804eace941335
This commit is contained in:
Guilherme Varandas 2018-10-05 11:11:21 -07:00 committed by Facebook Github Bot
parent 3ad5c9e016
commit f1d6e225c5

View File

@ -14,14 +14,10 @@ var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {ProgressViewIOS, StyleSheet, View} = ReactNative;
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
var TimerMixin = require('react-timer-mixin');
var ProgressViewExample = createReactClass({
displayName: 'ProgressViewExample',
mixins: [TimerMixin],
_rafId: (null: ?AnimationFrameID),
getInitialState() {
return {
@ -33,10 +29,16 @@ var ProgressViewExample = createReactClass({
this.updateProgress();
},
componentWillUnmount() {
if (this._rafId != null) {
cancelAnimationFrame(this._rafId);
}
},
updateProgress() {
var progress = this.state.progress + 0.01;
this.setState({progress});
this.requestAnimationFrame(() => this.updateProgress());
this._rafId = requestAnimationFrame(() => this.updateProgress());
},
getProgress(offset) {