From 0842bdebc9482051aba6cd57f5f622f7820e14cf Mon Sep 17 00:00:00 2001 From: Himanshu Soni Date: Tue, 9 Oct 2018 14:41:34 -0500 Subject: [PATCH 1/2] remove createReactClass --- RNTester/js/ProgressViewIOSExample.js | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/RNTester/js/ProgressViewIOSExample.js b/RNTester/js/ProgressViewIOSExample.js index 2d431281a3abef..99cb5291988c33 100644 --- a/RNTester/js/ProgressViewIOSExample.js +++ b/RNTester/js/ProgressViewIOSExample.js @@ -10,41 +10,41 @@ '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 State = {| + progress: number, +|}; - getInitialState() { - return { - progress: 0, - }; - }, +class ProgressViewExample extends React.Component<{}, 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 +75,8 @@ var ProgressViewExample = createReactClass({ /> ); - }, -}); + } +} exports.displayName = (undefined: ?string); exports.framework = 'React'; From d30a4c5805b3039d0f5707fb463b62713a3379ad Mon Sep 17 00:00:00 2001 From: Himanshu Soni Date: Tue, 9 Oct 2018 16:09:54 -0500 Subject: [PATCH 2/2] update remove createReactClass --- RNTester/js/ProgressViewIOSExample.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RNTester/js/ProgressViewIOSExample.js b/RNTester/js/ProgressViewIOSExample.js index 99cb5291988c33..7c6ebfe6c2a5ab 100644 --- a/RNTester/js/ProgressViewIOSExample.js +++ b/RNTester/js/ProgressViewIOSExample.js @@ -14,11 +14,12 @@ const React = require('react'); const ReactNative = require('react-native'); const {ProgressViewIOS, StyleSheet, View} = ReactNative; +type Props = {||}; type State = {| progress: number, |}; -class ProgressViewExample extends React.Component<{}, State> { +class ProgressViewExample extends React.Component { _rafId: ?AnimationFrameID = null; state = {