Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[createReactClass] Remove createReactClass from ProgressBarAndroidExample #21874

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 31 additions & 25 deletions RNTester/js/ProgressBarAndroidExample.android.js
Expand Up @@ -10,39 +10,45 @@

'use strict';

var ProgressBar = require('ProgressBarAndroid');
var React = require('React');
var createReactClass = require('create-react-class');
var RNTesterBlock = require('RNTesterBlock');
var RNTesterPage = require('RNTesterPage');

var MovingBar = createReactClass({
displayName: 'MovingBar',
_intervalID: (null: ?IntervalID),

getInitialState: function() {
return {
progress: 0,
};
},

componentDidMount: function() {
const ProgressBar = require('ProgressBarAndroid');
const React = require('React');
const RNTesterBlock = require('RNTesterBlock');
const RNTesterPage = require('RNTesterPage');

type ProgressBarProps = React.ElementConfig<typeof ProgressBar>;

type MovingBarProps = $ReadOnly<$Diff<ProgressBarProps, {
progress: $ElementType<ProgressBarProps, 'progress'>
}>>;

type MovingBarState = {
progress: number
};

class MovingBar extends React.Component<MovingBarProps, MovingBarState> {
_intervalID: (null: ?IntervalID);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null: Parsing error: Unexpected token, expected ")"

27 |
28 | class MovingBar extends React.Component<MovingBarProps, MovingBarState> {

29 | _intervalID: (null: ?IntervalID);
| ^
30 |
31 | state = {
32 | progress: 0,


state = {
progress: 0,
};

componentDidMount() {
this._intervalID = setInterval(() => {
var progress = (this.state.progress + 0.02) % 1;
this.setState({progress: progress});
const progress = (this.state.progress + 0.02) % 1;
this.setState({ progress });
}, 50);
},
}

componentWillUnmount: function() {
componentWillUnmount() {
if (this._intervalID != null) {
clearInterval(this._intervalID);
}
},
}

render: function() {
render() {
return <ProgressBar progress={this.state.progress} {...this.props} />;
},
});
}
};

class ProgressBarAndroidExample extends React.Component<{}> {
static title = '<ProgressBarAndroid>';
Expand Down