ProgressBarAndroid

React 组建包裹了只是 Android 部分的 ProgressBar。这个组件是被用来提示这个应用正在加载或者在应用里面有一些操作。

例子:

1. render: function() {
2. var progressBar =
3. <View style={styles.container}>
4. <ProgressBar styleAttr="Inverse" />
5. </View>;

7. return (
8. <MyLoadingComponent
9. componentView={componentView}
10. loadingView={progressBar}
11. style={styles.loadingComponent}
12. />
13. );
14. },

属性

styleAttr 样式属性

进度条的样式,包括:

  • Horizontal
  • Small
  • Large
  • Inverse
  • SmallInverse
  • LargeInverse

testID 字符串 在端对端测试里面被用来定位这个视图。

例子

1. 'use strict';

3. var ProgressBar = require('ProgressBarAndroid');
4. var React = require('React');
5. var UIExplorerBlock = require('UIExplorerBlock');
6. var UIExplorerPage = require('UIExplorerPage');

8. var ProgressBarAndroidExample = React.createClass({

10. statics: {
11. title: '<ProgressBarAndroid>',
12. description: 'Visual indicator of progress of some operation. ' +
13. 'Shows either a cyclic animation or a horizontal bar.',
14. },

16. render: function() {
17. return (
18. <UIExplorerPage title="ProgressBar Examples">
19. <UIExplorerBlock title="Default ProgressBar">
20. <ProgressBar />
21. </UIExplorerBlock>

23. <UIExplorerBlock title="Small ProgressBar">
24. <ProgressBar styleAttr="Small" />
25. </UIExplorerBlock>

27. <UIExplorerBlock title="Large ProgressBar">
28. <ProgressBar styleAttr="Large" />
29. </UIExplorerBlock>

31. <UIExplorerBlock title="Inverse ProgressBar">
32. <ProgressBar styleAttr="Inverse" />
33. </UIExplorerBlock>

35. <UIExplorerBlock title="Small Inverse ProgressBar">
36. <ProgressBar styleAttr="SmallInverse" />
37. </UIExplorerBlock>

39. <UIExplorerBlock title="Large Inverse ProgressBar">
40. <ProgressBar styleAttr="LargeInverse" />
41. </UIExplorerBlock>
42. </UIExplorerPage>
43. );
44. },
45. });

47. module.exports = ProgressBarAndroidExample;