Skip to content

Commit 3791527

Browse files
mikehobioblador
authored andcommitted
Add strokeCap prop for Progress.Circle (#45)
* Add `strokeCap` prop for `Progress.Circle` Changes: Allows for further customization of the `Progress.Circle` by adding a `strokeCap` prop, similar to the `Progress.CircleSnail` component. * Add prop to Arc to allow for custom strokeCap * Update project readme
1 parent 956afe3 commit 3791527

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

Circle.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export class ProgressCircle extends Component {
8989
showsText,
9090
size,
9191
style,
92+
strokeCap,
9293
textStyle,
9394
thickness,
9495
unfilledColor,
@@ -154,6 +155,7 @@ export class ProgressCircle extends Component {
154155
startAngle={0}
155156
endAngle={(indeterminate ? 1.8 : 2) * Math.PI}
156157
stroke={borderColor || color}
158+
strokeCap={strokeCap}
157159
strokeWidth={border}
158160
/>
159161
) : false}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# react-native-progress
22

3-
Progress indicators and spinners for React Native using ReactART.
3+
Progress indicators and spinners for React Native using ReactART.
44

55
![progress-demo](https://cloud.githubusercontent.com/assets/378279/11212043/64fb1420-8d01-11e5-9ec0-5e175a837c62.gif)
66

@@ -10,7 +10,7 @@ Progress indicators and spinners for React Native using ReactART.
1010

1111
### ReactART based components
1212

13-
To use the `Pie` or `Circle` components, you need to include the ART library in your project on iOS, for android it's already included.
13+
To use the `Pie` or `Circle` components, you need to include the ART library in your project on iOS, for android it's already included.
1414

1515
#### For CocoaPod users:
1616

@@ -72,6 +72,7 @@ All of the props under *Properties* in addition to the following:
7272
|**`formatText(progress)`**|A function returning a string to be displayed for the textual representation. |*See source*|
7373
|**`textStyle`**|Styles for progress text, defaults to a same `color` as circle and `fontSize` proportional to `size` prop. |*None*|
7474
|**`direction`**|Direction of the circle `clockwise` or `counter-clockwise` |`clockwise`|
75+
|**`strokeCap`**|Stroke Cap style for the circle `butt`, `square` or `round` |`butt`|
7576

7677
### `Progress.Pie`
7778

@@ -95,14 +96,14 @@ All of the props under *Properties* in addition to the following:
9596

9697
## Examples
9798

98-
* [`Example` project bundled with this module](https://github.com/oblador/react-native-progress/tree/master/Example)
99+
* [`Example` project bundled with this module](https://github.com/oblador/react-native-progress/tree/master/Example)
99100
* [react-native-image-progress](https://github.com/oblador/react-native-image-progress)
100101

101102
## [Changelog](https://github.com/oblador/react-native-progress/releases)
102103

103104
## Thanks
104105

105-
To [Mandarin Drummond](https://github.com/MandarinConLaBarba) for giving me the NPM name.
106+
To [Mandarin Drummond](https://github.com/MandarinConLaBarba) for giving me the NPM name.
106107

107108
## License
108109

Shapes/Arc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ export default class Arc extends Component {
4949
top: PropTypes.number,
5050
left: PropTypes.number,
5151
}),
52+
strokeCap: PropTypes.string,
5253
strokeWidth: PropTypes.number,
5354
direction: PropTypes.oneOf(['clockwise', 'counter-clockwise']),
5455
};
5556

5657
static defaultProps = {
5758
startAngle: 0,
5859
offset: { top: 0, left: 0 },
60+
strokeCap: 'butt',
5961
strokeWidth: 0,
6062
direction: 'clockwise',
6163
};
@@ -67,6 +69,7 @@ export default class Arc extends Component {
6769
radius,
6870
offset,
6971
direction,
72+
strokeCap,
7073
strokeWidth,
7174
...restProps
7275
} = this.props;
@@ -83,7 +86,7 @@ export default class Arc extends Component {
8386
return (
8487
<ART.Shape
8588
d={path}
86-
strokeCap="butt"
89+
strokeCap={strokeCap}
8790
strokeWidth={strokeWidth}
8891
{...restProps}
8992
/>

0 commit comments

Comments
 (0)