mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
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:
parent
5f3d08d524
commit
a45219966c
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user