Skip to content

Commit 63848bd

Browse files
jingcfacebook-github-bot
authored andcommitted
Revert D6080118: [react-native][PR] Delegate to ProgressBarAndroid from ActivityIndicator on Android, instead of the other way around
Differential Revision: D6080118 fbshipit-source-id: efd75bbcc07de084213d3791520006090001364d
1 parent c1223c5 commit 63848bd

2 files changed

Lines changed: 24 additions & 35 deletions

File tree

Libraries/Components/ActivityIndicator/ActivityIndicator.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
const ColorPropType = require('ColorPropType');
1515
const NativeMethodsMixin = require('NativeMethodsMixin');
1616
const Platform = require('Platform');
17-
const ProgressBarAndroid = require('ProgressBarAndroid');
18-
const PropTypes = require('prop-types');
1917
const React = require('React');
18+
const PropTypes = require('prop-types');
2019
const StyleSheet = require('StyleSheet');
2120
const View = require('View');
2221
const ViewPropTypes = require('ViewPropTypes');
@@ -136,20 +135,16 @@ const ActivityIndicator = createReactClass({
136135
break;
137136
}
138137

139-
const nativeProps = {
140-
...props,
141-
style: sizeStyle,
142-
styleAttr: 'Normal',
143-
indeterminate: true,
144-
};
145-
146138
return (
147-
<View onLayout={onLayout} style={[styles.container, style]}>
148-
{Platform.OS === 'ios' ? (
149-
<RCTActivityIndicator {...nativeProps} />
150-
) : (
151-
<ProgressBarAndroid {...nativeProps} />
152-
)}
139+
<View
140+
onLayout={onLayout}
141+
style={[styles.container, style]}>
142+
<RCTActivityIndicator
143+
{...props}
144+
style={sizeStyle}
145+
styleAttr="Normal"
146+
indeterminate
147+
/>
153148
</View>
154149
);
155150
}
@@ -174,7 +169,18 @@ if (Platform.OS === 'ios') {
174169
var RCTActivityIndicator = requireNativeComponent(
175170
'RCTActivityIndicatorView',
176171
ActivityIndicator,
177-
{ nativeOnly: { activityIndicatorViewStyle: true } }
172+
{nativeOnly: {activityIndicatorViewStyle: true}},
173+
);
174+
} else if (Platform.OS === 'android') {
175+
var RCTActivityIndicator = requireNativeComponent(
176+
'AndroidProgressBar',
177+
ActivityIndicator,
178+
// Ignore props that are specific to non inderterminate ProgressBar.
179+
{nativeOnly: {
180+
indeterminate: true,
181+
progress: true,
182+
styleAttr: true,
183+
}},
178184
);
179185
}
180186

Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ const React = require('React');
1717
const ReactNative = require('ReactNative');
1818
const ViewPropTypes = require('ViewPropTypes');
1919

20-
const requireNativeComponent = require('requireNativeComponent');
21-
2220
const STYLE_ATTRIBUTES = [
2321
'Horizontal',
2422
'Normal',
@@ -80,10 +78,6 @@ class ProgressBarAndroid extends ReactNative.NativeComponent {
8078
* - LargeInverse
8179
*/
8280
styleAttr: PropTypes.oneOf(STYLE_ATTRIBUTES),
83-
/**
84-
* Whether to show the ProgressBar (true, the default) or hide it (false).
85-
*/
86-
animating: PropTypes.bool,
8781
/**
8882
* If the progress bar will show indeterminate progress. Note that this
8983
* can only be false if styleAttr is Horizontal.
@@ -105,8 +99,7 @@ class ProgressBarAndroid extends ReactNative.NativeComponent {
10599

106100
static defaultProps = {
107101
styleAttr: 'Normal',
108-
indeterminate: true,
109-
animating: true,
102+
indeterminate: true
110103
};
111104

112105
componentDidMount() {
@@ -119,18 +112,8 @@ class ProgressBarAndroid extends ReactNative.NativeComponent {
119112
}
120113

121114
render() {
122-
return <AndroidProgressBar {...this.props} />;
115+
return <ActivityIndicator {...this.props} animating={true} />;
123116
}
124117
}
125118

126-
const AndroidProgressBar = requireNativeComponent(
127-
'AndroidProgressBar',
128-
ProgressBarAndroid,
129-
{
130-
nativeOnly: {
131-
animating: true,
132-
},
133-
}
134-
);
135-
136119
module.exports = ProgressBarAndroid;

0 commit comments

Comments
 (0)