mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-13 09:20:15 +08:00
Support progress in ProgressBarAndroid
Differential Revision: D2626321 fb-gh-sync-id: a358a1db8c8f3b4a41dc9a600ee691e6e60310f3
This commit is contained in:
committed by
facebook-github-bot-7
parent
96b76fc85f
commit
527d11ce01
@@ -26,6 +26,18 @@ var STYLE_ATTRIBUTES = [
|
||||
'LargeInverse'
|
||||
];
|
||||
|
||||
var indeterminateType = function(props, propName, componentName) {
|
||||
var checker = function() {
|
||||
var indeterminate = props[propName];
|
||||
var styleAttr = props.styleAttr;
|
||||
if (!indeterminate && styleAttr !== 'Horizontal') {
|
||||
return new Error('indeterminate=false is only valid for styleAttr=Horizontal');
|
||||
}
|
||||
};
|
||||
|
||||
return ReactPropTypes.bool(props, propName, componentName) || checker();
|
||||
};
|
||||
|
||||
/**
|
||||
* React component that wraps the Android-only `ProgressBar`. This component is used to indicate
|
||||
* that the app is loading or there is some activity in the app.
|
||||
@@ -62,6 +74,15 @@ var ProgressBarAndroid = React.createClass({
|
||||
* - LargeInverse
|
||||
*/
|
||||
styleAttr: ReactPropTypes.oneOf(STYLE_ATTRIBUTES),
|
||||
/**
|
||||
* If the progress bar will show indeterminate progress. Note that this
|
||||
* can only be false if styleAttr is Horizontal.
|
||||
*/
|
||||
indeterminate: indeterminateType,
|
||||
/**
|
||||
* The progress value (between 0 and 1).
|
||||
*/
|
||||
progress: ReactPropTypes.number,
|
||||
/**
|
||||
* Color of the progress bar.
|
||||
*/
|
||||
@@ -75,6 +96,7 @@ var ProgressBarAndroid = React.createClass({
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
styleAttr: 'Large',
|
||||
indeterminate: true
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user