diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 1ed1a7ebcc3e2d..3a47a3d8f4f9b3 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -14,8 +14,9 @@ const ColorPropType = require('ColorPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); -const React = require('React'); +const ProgressBarAndroid = require('ProgressBarAndroid'); const PropTypes = require('prop-types'); +const React = require('React'); const StyleSheet = require('StyleSheet'); const View = require('View'); const ViewPropTypes = require('ViewPropTypes'); @@ -135,16 +136,20 @@ const ActivityIndicator = createReactClass({ break; } + const nativeProps = { + ...props, + style: sizeStyle, + styleAttr: 'Normal', + indeterminate: true, + }; + return ( - - + + {Platform.OS === 'ios' ? ( + + ) : ( + + )} ); } @@ -169,18 +174,7 @@ if (Platform.OS === 'ios') { var RCTActivityIndicator = requireNativeComponent( 'RCTActivityIndicatorView', ActivityIndicator, - {nativeOnly: {activityIndicatorViewStyle: true}}, - ); -} else if (Platform.OS === 'android') { - var RCTActivityIndicator = requireNativeComponent( - 'AndroidProgressBar', - ActivityIndicator, - // Ignore props that are specific to non inderterminate ProgressBar. - {nativeOnly: { - indeterminate: true, - progress: true, - styleAttr: true, - }}, + { nativeOnly: { activityIndicatorViewStyle: true } } ); } diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index 21fc5185a611bd..de5e0e52e35c40 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -17,6 +17,8 @@ const React = require('React'); const ReactNative = require('ReactNative'); const ViewPropTypes = require('ViewPropTypes'); +const requireNativeComponent = require('requireNativeComponent'); + const STYLE_ATTRIBUTES = [ 'Horizontal', 'Normal', @@ -78,6 +80,10 @@ class ProgressBarAndroid extends ReactNative.NativeComponent { * - LargeInverse */ styleAttr: PropTypes.oneOf(STYLE_ATTRIBUTES), + /** + * Whether to show the ProgressBar (true, the default) or hide it (false). + */ + animating: PropTypes.bool, /** * If the progress bar will show indeterminate progress. Note that this * can only be false if styleAttr is Horizontal. @@ -99,7 +105,8 @@ class ProgressBarAndroid extends ReactNative.NativeComponent { static defaultProps = { styleAttr: 'Normal', - indeterminate: true + indeterminate: true, + animating: true, }; componentDidMount() { @@ -112,8 +119,18 @@ class ProgressBarAndroid extends ReactNative.NativeComponent { } render() { - return ; + return ; } } +const AndroidProgressBar = requireNativeComponent( + 'AndroidProgressBar', + ProgressBarAndroid, + { + nativeOnly: { + animating: true, + }, + } +); + module.exports = ProgressBarAndroid;