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 https://github.com/facebook/react-native/pull/4974

Reviewed By: svcscm

Differential Revision: D2811229

Pulled By: bestander

fb-gh-sync-id: 087f68d1919fe933d86e5194112bf7a5f5b3f3c6
This commit is contained in:
realaboo 2016-01-07 08:44:14 -08:00 коммит произвёл facebook-github-bot-3
Родитель 5f3d08d524
Коммит a45219966c
3 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -60,6 +60,10 @@ var ProgressBarAndroidExample = React.createClass({
<ProgressBar />
</UIExplorerBlock>
<UIExplorerBlock title="Normal ProgressBar">
<ProgressBar styleAttr="Normal" />
</UIExplorerBlock>
<UIExplorerBlock title="Small ProgressBar">
<ProgressBar styleAttr="Small" />
</UIExplorerBlock>

Просмотреть файл

@ -21,6 +21,7 @@ var requireNativeComponent = require('requireNativeComponent');
var STYLE_ATTRIBUTES = [
'Horizontal',
'Normal',
'Small',
'Large',
'Inverse',
@ -70,6 +71,7 @@ var ProgressBarAndroid = React.createClass({
* Style of the ProgressBar. One of:
*
* - Horizontal
* - Normal (default)
* - Small
* - Large
* - Inverse
@ -98,7 +100,7 @@ var ProgressBarAndroid = React.createClass({
getDefaultProps: function() {
return {
styleAttr: 'Large',
styleAttr: 'Normal',
indeterminate: true
};
},

Просмотреть файл

@ -31,7 +31,7 @@ public class ReactProgressBarViewManager extends
/* package */ static final String PROP_PROGRESS = "progress";
/* package */ static final String REACT_CLASS = "AndroidProgressBar";
/* package */ static final String DEFAULT_STYLE = "Large";
/* package */ static final String DEFAULT_STYLE = "Normal";
@Override
public String getName() {
@ -99,6 +99,8 @@ public class ReactProgressBarViewManager extends
return android.R.attr.progressBarStyleSmallInverse;
} else if (styleStr.equals("LargeInverse")) {
return android.R.attr.progressBarStyleLargeInverse;
} else if (styleStr.equals("Normal")) {
return android.R.attr.progressBarStyle;
} else {
throw new JSApplicationIllegalArgumentException("Unknown ProgressBar style: " + styleStr);
}