Skip to content

Commit

Permalink
Removing TimerMixin on ProgressViewIOSExample (#21500)
Browse files Browse the repository at this point in the history
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: #21500

Reviewed By: TheSavior

Differential Revision: D10218366

Pulled By: RSNara

fbshipit-source-id: b44a0bbb50f6b0e85f406904131804eace941335
  • Loading branch information
gvarandas authored and facebook-github-bot committed Oct 5, 2018
1 parent 3ad5c9e commit f1d6e22
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions RNTester/js/ProgressViewIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down

0 comments on commit f1d6e22

Please sign in to comment.