Skip to content

Commit ccdf2a9

Browse files
authored
Merge pull request #30 from react-native-community/Naturalclar-patch-1
Update README with examples and props reference
2 parents d1592ea + 4a5bf29 commit ccdf2a9

File tree

1 file changed

+111
-9
lines changed

1 file changed

+111
-9
lines changed

README.md

Lines changed: 111 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,123 @@ yarn start
8888
yarn android
8989
```
9090

91-
## Usage
91+
# Example
9292
```jsx
93-
import { View } from 'react-native'
93+
import React from 'react';
94+
import {View, StyleSheet, Text} from 'react-native';
9495
import { ProgressBar } from '@react-native-community/progress-bar-android';
9596

96-
97-
export const Example = () => {
98-
return (
99-
<View>
100-
<ProgressBar styleAttr="Horizontal" />
101-
</View>
102-
)
97+
export default function App() {
98+
return (
99+
<View style={styles.container}>
100+
<View style={styles.example}>
101+
<Text>Circle Progress Indicator</Text>
102+
<ProgressBar />
103+
</View>
104+
<View style={styles.example}>
105+
<Text>Horizontal Progress Indicator</Text>
106+
<ProgressBar styleAttr="Horizontal" />
107+
</View>
108+
<View style={styles.example}>
109+
<Text>Colored Progress Indicator</Text>
110+
<ProgressBar styleAttr="Horizontal" color="#2196F3" />
111+
</View>
112+
<View style={styles.example}>
113+
<Text>Fixed Progress Value</Text>
114+
<ProgressBar
115+
styleAttr="Horizontal"
116+
indeterminate={false}
117+
progress={0.5}
118+
/>
119+
</View>
120+
</View>
121+
);
103122
}
104123

124+
const styles = StyleSheet.create({
125+
container: {
126+
flex: 1,
127+
justifyContent: 'center',
128+
alignItems: 'center',
129+
},
130+
example: {
131+
marginVertical: 24,
132+
},
133+
});
105134
```
135+
136+
# Reference
137+
138+
## Props
139+
140+
Inherits [View Props](https://reactnative.dev/docs/view#props).
141+
142+
### `animating`
143+
144+
Whether to show the ProgressBar (true, the default) or hide it (false).
145+
146+
| Type | Required |
147+
| ---- | -------- |
148+
| bool | No |
149+
150+
---
151+
152+
### `color`
153+
154+
Color of the progress bar.
155+
156+
| Type | Required |
157+
| ------------------ | -------- |
158+
| [color](colors.md) | No |
159+
160+
---
161+
162+
### `indeterminate`
163+
164+
If the progress bar will show indeterminate progress. Note that this can only be false if styleAttr is Horizontal, and requires a `progress` value.
165+
166+
| Type | Required |
167+
| ----------------- | -------- |
168+
| indeterminateType | No |
169+
170+
---
171+
172+
### `progress`
173+
174+
The progress value (between 0 and 1).
175+
176+
| Type | Required |
177+
| ------ | -------- |
178+
| number | No |
179+
180+
---
181+
182+
### `styleAttr`
183+
184+
Style of the ProgressBar. One of:
185+
186+
- Horizontal
187+
- Normal (default)
188+
- Small
189+
- Large
190+
- Inverse
191+
- SmallInverse
192+
- LargeInverse
193+
194+
| Type | Required |
195+
| ----------------------------------------------------------------------------------------- | -------- |
196+
| enum('Horizontal', 'Normal', 'Small', 'Large', 'Inverse', 'SmallInverse', 'LargeInverse') | No |
197+
198+
---
199+
200+
### `testID`
201+
202+
Used to locate this view in end-to-end tests.
203+
204+
| Type | Required |
205+
| ------ | -------- |
206+
| string | No |
207+
106208

107209
[build-badge]: https://img.shields.io/circleci/project/github/react-native-community/progress-bar-android/master.svg?style=flat-square
108210
[build]: https://circleci.com/gh/react-native-community/progress-bar-android

0 commit comments

Comments
 (0)