Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: unfilledEndAngle prop to Circle.js #243

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 10 additions & 4 deletions Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class ProgressCircle extends Component {
thickness: PropTypes.number,
unfilledColor: PropTypes.string,
endAngle: PropTypes.number,
unfilledEndAngle: PropTypes.number,
allowFontScaling: PropTypes.bool,
};

Expand All @@ -55,6 +56,7 @@ export class ProgressCircle extends Component {
size: 40,
thickness: 3,
endAngle: 0.9,
unfilledEndAngle: 0.9,
allowFontScaling: true,
};

Expand Down Expand Up @@ -96,6 +98,7 @@ export class ProgressCircle extends Component {
thickness,
unfilledColor,
endAngle,
unfilledEndAngle,
allowFontScaling,
...restProps
} = this.props;
Expand All @@ -114,8 +117,11 @@ 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(Animated.multiply(progress, CIRCLE), unfilledEndAngle)
: progress * CIRCLE * unfilledEndAngle;
const endUnfilledAngleValue = animated
? Animated.multiply(unfilledEndAngle, CIRCLE)
: unfilledEndAngle * CIRCLE;

return (
<View style={[styles.container, style]} {...restProps}>
Expand All @@ -137,13 +143,13 @@ export class ProgressCircle extends Component {
: undefined
}
>
{unfilledColor && progressValue !== 1 ? (
{unfilledColor ? (
<Shape
fill={fill}
radius={radius}
offset={offset}
startAngle={angle}
endAngle={CIRCLE}
endAngle={endUnfilledAngleValue}
direction={direction}
stroke={unfilledColor}
strokeWidth={thickness}
Expand Down