diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js
index a6f64f011ef074..9512fd1dfabec2 100644
--- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js
+++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js
@@ -19,7 +19,7 @@ import type {ViewProps} from 'ViewPropTypes';
const AndroidProgressBar = requireNativeComponent('AndroidProgressBar');
-type Props = $ReadOnly<{|
+export type ProgressBarAndroidProps = $ReadOnly<{|
...ViewProps,
/**
@@ -83,7 +83,7 @@ type Props = $ReadOnly<{|
* ```
*/
const ProgressBarAndroid = (
- props: Props,
+ props: ProgressBarAndroidProps,
forwardedRef: ?React.Ref<'AndroidProgressBar'>,
) => {
return ;
@@ -98,4 +98,6 @@ ProgressBarAndroidToExport.defaultProps = {
animating: true,
};
-module.exports = (ProgressBarAndroidToExport: Class>);
+module.exports = (ProgressBarAndroidToExport: Class<
+ NativeComponent,
+>);
diff --git a/RNTester/js/ProgressBarAndroidExample.android.js b/RNTester/js/ProgressBarAndroidExample.android.js
index c806a4c6c331cb..9c45fc54c40127 100644
--- a/RNTester/js/ProgressBarAndroidExample.android.js
+++ b/RNTester/js/ProgressBarAndroidExample.android.js
@@ -12,37 +12,49 @@
const ProgressBar = require('ProgressBarAndroid');
const React = require('React');
-const createReactClass = require('create-react-class');
const RNTesterBlock = require('RNTesterBlock');
const RNTesterPage = require('RNTesterPage');
-const MovingBar = createReactClass({
- displayName: 'MovingBar',
- _intervalID: (null: ?IntervalID),
+import type {ProgressBarAndroidProps} from 'ProgressBarAndroid';
- getInitialState: function() {
- return {
- progress: 0,
- };
- },
+type MovingBarProps = $ReadOnly<{|
+ ...$Diff<
+ ProgressBarAndroidProps,
+ {
+ progress: ?number,
+ },
+ >,
+ indeterminate: false,
+|}>;
- componentDidMount: function() {
+type MovingBarState = {
+ progress: number,
+};
+
+class MovingBar extends React.Component {
+ _intervalID: ?IntervalID = null;
+
+ state = {
+ progress: 0,
+ };
+
+ componentDidMount() {
this._intervalID = setInterval(() => {
const progress = (this.state.progress + 0.02) % 1;
- this.setState({progress: progress});
+ this.setState({progress});
}, 50);
- },
+ }
- componentWillUnmount: function() {
+ componentWillUnmount() {
if (this._intervalID != null) {
clearInterval(this._intervalID);
}
- },
+ }
- render: function() {
+ render() {
return ;
- },
-});
+ }
+}
class ProgressBarAndroidExample extends React.Component<{}> {
static title = '';