1010 */
1111'use strict' ;
1212
13- var NativeMethodsMixin = require ( 'NativeMethodsMixin' ) ;
14- var React = require ( 'React' ) ;
15- var PropTypes = require ( 'prop-types' ) ;
16- var ViewPropTypes = require ( 'ViewPropTypes' ) ;
17- var ColorPropType = require ( 'ColorPropType' ) ;
13+ const ActivityIndicator = require ( 'ActivityIndicator' ) ;
14+ const ColorPropType = require ( 'ColorPropType' ) ;
15+ const PropTypes = require ( 'prop-types' ) ;
16+ const React = require ( 'React' ) ;
17+ const ReactNative = require ( 'ReactNative' ) ;
18+ const ViewPropTypes = require ( 'ViewPropTypes' ) ;
1819
19- var createReactClass = require ( 'create-react-class' ) ;
20- var requireNativeComponent = require ( 'requireNativeComponent' ) ;
21-
22- var STYLE_ATTRIBUTES = [
20+ const STYLE_ATTRIBUTES = [
2321 'Horizontal' ,
2422 'Normal' ,
2523 'Small' ,
@@ -29,10 +27,10 @@ var STYLE_ATTRIBUTES = [
2927 'LargeInverse' ,
3028] ;
3129
32- var indeterminateType = function ( props , propName , componentName , ...rest ) {
33- var checker = function ( ) {
34- var indeterminate = props [ propName ] ;
35- var styleAttr = props . styleAttr ;
30+ const indeterminateType = function ( props , propName , componentName , ...rest ) {
31+ const checker = function ( ) {
32+ const indeterminate = props [ propName ] ;
33+ const styleAttr = props . styleAttr ;
3634 if ( ! indeterminate && styleAttr !== 'Horizontal' ) {
3735 return new Error ( 'indeterminate=false is only valid for styleAttr=Horizontal' ) ;
3836 }
@@ -64,10 +62,10 @@ var indeterminateType = function(props, propName, componentName, ...rest) {
6462 * },
6563 * ```
6664 */
67- var ProgressBarAndroid = createReactClass ( {
68- displayName : 'ProgressBarAndroid' ,
69- propTypes : {
65+ class ProgressBarAndroid extends ReactNative . NativeComponent {
66+ static propTypes = {
7067 ...ViewPropTypes ,
68+
7169 /**
7270 * Style of the ProgressBar. One of:
7371 *
@@ -97,35 +95,25 @@ var ProgressBarAndroid = createReactClass({
9795 * Used to locate this view in end-to-end tests.
9896 */
9997 testID : PropTypes . string ,
100- } ,
101-
102- getDefaultProps : function ( ) {
103- return {
104- styleAttr : 'Normal' ,
105- indeterminate : true
106- } ;
107- } ,
98+ } ;
10899
109- mixins : [ NativeMethodsMixin ] ,
100+ static defaultProps = {
101+ styleAttr : 'Normal' ,
102+ indeterminate : true
103+ } ;
110104
111- componentDidMount : function ( ) {
105+ componentDidMount ( ) {
112106 if ( this . props . indeterminate && this . props . styleAttr !== 'Horizontal' ) {
113107 console . warn (
114108 'Circular indeterminate `ProgressBarAndroid`' +
115109 'is deprecated. Use `ActivityIndicator` instead.'
116110 ) ;
117111 }
118- } ,
119-
120- render : function ( ) {
121- return < AndroidProgressBar { ...this . props } /> ;
122- } ,
123- } ) ;
112+ }
124113
125- var AndroidProgressBar = requireNativeComponent (
126- 'AndroidProgressBar' ,
127- ProgressBarAndroid ,
128- { nativeOnly : { animating : true } } ,
129- ) ;
114+ render ( ) {
115+ return < ActivityIndicator { ...this . props } animating = { true } /> ;
116+ }
117+ }
130118
131119module . exports = ProgressBarAndroid ;
0 commit comments