Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ProgressCircle extends Component {
showsText: false,
size: 40,
thickness: 3,
endAngle: 0.9,
endAngle: 1,
allowFontScaling: true,
};

Expand Down Expand Up @@ -95,6 +95,7 @@ export class ProgressCircle extends Component {
textStyle,
thickness,
unfilledColor,
unfilledStrokeCap,
endAngle,
allowFontScaling,
...restProps
Expand All @@ -114,8 +115,8 @@ export class ProgressCircle extends Component {
const Shape = animated ? AnimatedArc : Arc;
const progressValue = animated ? this.progressValue : progress;
const angle = animated
? Animated.multiply(progress, CIRCLE)
: progress * CIRCLE;
? Animated.multiply(progress, CIRCLE * endAngle)
: progress * CIRCLE * endAngle;

return (
<View style={[styles.container, style]} {...restProps}>
Expand Down Expand Up @@ -144,9 +145,10 @@ export class ProgressCircle extends Component {
radius={radius}
offset={offset}
startAngle={angle}
endAngle={CIRCLE}
endAngle={CIRCLE * endAngle}
direction={direction}
stroke={unfilledColor}
strokeCap={unfilledStrokeCap}
strokeWidth={thickness}
/>
) : (
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ All of the props under _Properties_ in addition to the following:
| Prop | Description | Default |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **`size`** | Diameter of the circle. | `40` |
| **`endAngle`** | Determines the endAngle of the circle. A number between `0` and `1`. The final endAngle would be the number multiplied by 2π | `0.9` |
| **`endAngle`** | Determines the endAngle of the circle. A number between `0` and `1`. The final endAngle would be the number multiplied by 2π | `1` |
| **`thickness`** | Thickness of the inner circle. | `3` |
| **`showsText`** | Whether or not to show a text representation of current progress. | `false` |
| **`formatText(progress)`** | A function returning a string to be displayed for the textual representation. | _See source_ |
| **`textStyle`** | Styles for progress text, defaults to a same `color` as circle and `fontSize` proportional to `size` prop. | _None_ |
| **`allowFontScaling`** | Whether or not to respect device font scale setting. | _true_ |
| **`direction`** | Direction of the circle `clockwise` or `counter-clockwise`. | `clockwise` |
| **`strokeCap`** | Stroke Cap style for the circle `butt`, `square` or `round`. | `butt` |
| **`unfilledStrokeCap`** | Stroke Cap style for the remaining progress `butt`, `square` or `round`. | `butt` |
| **`fill`** | Fill color of the inner circle. | None (transparent) |

### `Progress.Pie`
Expand Down
13 changes: 11 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ declare module 'react-native-progress' {
* @memberof DefaultPropTypes
* @default rgba(0, 122, 255, 1)
*/
color?: string;
color?: string;

/**
* Color of the remaining progress.
Expand Down Expand Up @@ -225,6 +225,15 @@ declare module 'react-native-progress' {
*/
strokeCap?: 'butt' | 'square' | 'round';

/**
* Stroke Cap style for the remaining progress `butt`, `square` or `round`.
*
* @type {('butt' | 'square' | 'round')}
* @memberof CirclePropTypes
* @default butt
*/
unfilledStrokeCap?: 'butt' | 'square' | 'round';

/**
* Fill color of the inner circle.
*
Expand All @@ -239,7 +248,7 @@ declare module 'react-native-progress' {
*
* @type {number}
* @memberof CirclePropTypes
* @default 0.9
* @default 1
*/
endAngle?: number;
}
Expand Down