Skip to content

Commit a452199

Browse files
realaboofacebook-github-bot-3
authored andcommitted
ProgressBarAndroid: default value for styleAttr
Summary: Current default value of ProgressBarAndroid's styleAttr is "Large" which sets the ProgressBar's style to [Widget_ProgressBar_Large](http://developer.android.com/reference/android/R.style.html#Widget_ProgressBar_Large) at native side. But large is not the default style for the native side ProgressBar. For example, the size of the ProgressBar is 48dip for default style, but 76dip for large and 16dip for small as in the Material themes. Although the size of ProgressBarAndroid could be set in JS, it'll be better to have the same default style as in native side themes. My PR adds a "Normal" value for styleAttr prop and makes it the default value. Closes facebook#4974 Reviewed By: svcscm Differential Revision: D2811229 Pulled By: bestander fb-gh-sync-id: 087f68d1919fe933d86e5194112bf7a5f5b3f3c6
1 parent 5f3d08d commit a452199

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Examples/UIExplorer/ProgressBarAndroidExample.android.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ var ProgressBarAndroidExample = React.createClass({
6060
<ProgressBar />
6161
</UIExplorerBlock>
6262

63+
<UIExplorerBlock title="Normal ProgressBar">
64+
<ProgressBar styleAttr="Normal" />
65+
</UIExplorerBlock>
66+
6367
<UIExplorerBlock title="Small ProgressBar">
6468
<ProgressBar styleAttr="Small" />
6569
</UIExplorerBlock>

Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var requireNativeComponent = require('requireNativeComponent');
2121

2222
var STYLE_ATTRIBUTES = [
2323
'Horizontal',
24+
'Normal',
2425
'Small',
2526
'Large',
2627
'Inverse',
@@ -70,6 +71,7 @@ var ProgressBarAndroid = React.createClass({
7071
* Style of the ProgressBar. One of:
7172
*
7273
* - Horizontal
74+
* - Normal (default)
7375
* - Small
7476
* - Large
7577
* - Inverse
@@ -98,7 +100,7 @@ var ProgressBarAndroid = React.createClass({
98100

99101
getDefaultProps: function() {
100102
return {
101-
styleAttr: 'Large',
103+
styleAttr: 'Normal',
102104
indeterminate: true
103105
};
104106
},

ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ReactProgressBarViewManager extends
3131
/* package */ static final String PROP_PROGRESS = "progress";
3232

3333
/* package */ static final String REACT_CLASS = "AndroidProgressBar";
34-
/* package */ static final String DEFAULT_STYLE = "Large";
34+
/* package */ static final String DEFAULT_STYLE = "Normal";
3535

3636
@Override
3737
public String getName() {
@@ -99,6 +99,8 @@ protected void onAfterUpdateTransaction(ProgressBarContainerView view) {
9999
return android.R.attr.progressBarStyleSmallInverse;
100100
} else if (styleStr.equals("LargeInverse")) {
101101
return android.R.attr.progressBarStyleLargeInverse;
102+
} else if (styleStr.equals("Normal")) {
103+
return android.R.attr.progressBarStyle;
102104
} else {
103105
throw new JSApplicationIllegalArgumentException("Unknown ProgressBar style: " + styleStr);
104106
}

0 commit comments

Comments
 (0)