remove createReactClass from RNTester/js/ProgressViewIOSExample.js (#21611)

Summary:
Related to #21581 .
Removed createReactClass from the RNTester/js/ProgressViewIOSExample.js

Test Plan
----------

  - [x] npm run prettier
  - [x] npm run flow-check-ios
  - [x] npm run flow-check-android
- [x] Run RNTester app, go to ProgressViewIOS component, everything works.

Release Notes
--------------

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

Reviewed By: TheSavior

Differential Revision: D10304566

Pulled By: RSNara

fbshipit-source-id: 98a9dc83a0517a2866c4174ae254e1a9d9785b87
This commit is contained in:
Himanshu Soni 2018-10-10 14:06:01 -07:00 committed by Facebook Github Bot
parent bf47589b8b
commit a7f958376b

View File

@ -10,41 +10,42 @@
'use strict';
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {ProgressViewIOS, StyleSheet, View} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {ProgressViewIOS, StyleSheet, View} = ReactNative;
var ProgressViewExample = createReactClass({
displayName: 'ProgressViewExample',
_rafId: (null: ?AnimationFrameID),
type Props = {||};
type State = {|
progress: number,
|};
getInitialState() {
return {
progress: 0,
};
},
class ProgressViewExample extends React.Component<Props, State> {
_rafId: ?AnimationFrameID = null;
state = {
progress: 0,
};
componentDidMount() {
this.updateProgress();
},
}
componentWillUnmount() {
if (this._rafId != null) {
cancelAnimationFrame(this._rafId);
}
},
}
updateProgress() {
updateProgress = () => {
var progress = this.state.progress + 0.01;
this.setState({progress});
this._rafId = requestAnimationFrame(() => this.updateProgress());
},
};
getProgress(offset) {
getProgress = offset => {
var progress = this.state.progress + offset;
return Math.sin(progress % Math.PI) % 1;
},
};
render() {
return (
@ -75,8 +76,8 @@ var ProgressViewExample = createReactClass({
/>
</View>
);
},
});
}
}
exports.displayName = (undefined: ?string);
exports.framework = 'React';