From a45219966c0e6ec58e87009dba046622aef8427e Mon Sep 17 00:00:00 2001 From: realaboo Date: Thu, 7 Jan 2016 08:44:14 -0800 Subject: [PATCH] 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 --- Examples/UIExplorer/ProgressBarAndroidExample.android.js | 4 ++++ .../ProgressBarAndroid/ProgressBarAndroid.android.js | 4 +++- .../react/views/progressbar/ReactProgressBarViewManager.java | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Examples/UIExplorer/ProgressBarAndroidExample.android.js b/Examples/UIExplorer/ProgressBarAndroidExample.android.js index b58cd73ca..19b182bc7 100644 --- a/Examples/UIExplorer/ProgressBarAndroidExample.android.js +++ b/Examples/UIExplorer/ProgressBarAndroidExample.android.js @@ -60,6 +60,10 @@ var ProgressBarAndroidExample = React.createClass({ + + + + diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index 974eaf97d..95e5504a4 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -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 }; }, diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java index 7f5bae7b3..82601cedd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java @@ -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); }