-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgressBarAndroid.android.js
107 lines (98 loc) · 2.61 KB
/
ProgressBarAndroid.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import type {ColorValue} from '../../StyleSheet/StyleSheet';
import type {ViewProps} from '../View/ViewPropTypes';
import ProgressBarAndroidNativeComponent from './ProgressBarAndroidNativeComponent';
const React = require('react');
export type ProgressBarAndroidProps = $ReadOnly<{|
...ViewProps,
/**
* Style of the ProgressBar and whether it shows indeterminate progress (e.g. spinner).
*
* `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
* `progress` value.
*/
...
| {|
styleAttr: 'Horizontal',
indeterminate: false,
progress: number,
|}
| {|
typeAttr:
| 'Horizontal'
| 'Normal'
| 'Small'
| 'Large'
| 'Inverse'
| 'SmallInverse'
| 'LargeInverse',
indeterminate: true,
|},
/**
* Whether to show the ProgressBar (true, the default) or hide it (false).
*/
animating?: ?boolean,
/**
* Color of the progress bar.
*/
color?: ?ColorValue,
/**
* Used to locate this view in end-to-end tests.
*/
testID?: ?string,
|}>;
/**
* React component that wraps the Android-only `ProgressBar`. This component is
* used to indicate that the app is loading or there is activity in the app.
*
* Example:
*
* ```
* render: function() {
* var progressBar =
* <View style={styles.container}>
* <ProgressBar styleAttr="Inverse" />
* </View>;
* return (
* <MyLoadingComponent
* componentView={componentView}
* loadingView={progressBar}
* style={styles.loadingComponent}
* />
* );
* },
* ```
*/
const ProgressBarAndroid = (
{
styleAttr = 'Normal',
indeterminate = true,
animating = true,
...restProps
}: ProgressBarAndroidProps,
forwardedRef: ?React.Ref<typeof ProgressBarAndroidNativeComponent>,
) => {
return (
<ProgressBarAndroidNativeComponent
styleAttr={styleAttr}
indeterminate={indeterminate}
animating={animating}
{...restProps}
ref={forwardedRef}
/>
);
};
const ProgressBarAndroidToExport = React.forwardRef(ProgressBarAndroid);
module.exports =
/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an
* error found when Flow v0.89 was deployed. To see the error, delete this
* comment and run Flow. */
(ProgressBarAndroidToExport: typeof ProgressBarAndroidNativeComponent);