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: alwaysUseEndAngle prop to Circle.js #245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
5 changes: 4 additions & 1 deletion Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class ProgressCircle extends Component {
textStyle: PropTypes.any,
thickness: PropTypes.number,
unfilledColor: PropTypes.string,
alwaysUseEndAngle: PropTypes.bool,
endAngle: PropTypes.number,
allowFontScaling: PropTypes.bool,
};
Expand All @@ -54,6 +55,7 @@ export class ProgressCircle extends Component {
showsText: false,
size: 40,
thickness: 3,
alwaysUseEndAngle: false,
endAngle: 0.9,
allowFontScaling: true,
};
Expand Down Expand Up @@ -95,6 +97,7 @@ export class ProgressCircle extends Component {
textStyle,
thickness,
unfilledColor,
alwaysUseEndAngle,
endAngle,
allowFontScaling,
...restProps
Expand Down Expand Up @@ -170,7 +173,7 @@ export class ProgressCircle extends Component {
<Arc
radius={size / 2}
startAngle={0}
endAngle={(indeterminate ? endAngle * 2 : 2) * Math.PI}
endAngle={(indeterminate ? endAngle * 2 : alwaysUseEndAngle ? endAngle * 2 : 2) * Math.PI}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
endAngle={(indeterminate ? endAngle * 2 : alwaysUseEndAngle ? endAngle * 2 : 2) * Math.PI}
endAngle={(indeterminate || alwaysUseEndAngle ? endAngle * 2 : 2) * Math.PI}

stroke={borderColor || color}
strokeCap={strokeCap}
strokeWidth={border}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ All of the props under _Properties_ in addition to the following:
| Prop | Description | Default |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **`size`** | Diameter of the circle. | `40` |
| **`alwaysUseEndAngle`** | endAngle, by default, is only used when `indeterminate` is `true`. This prop ensures endAngle is always used | `false` |
| **`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` |
| **`thickness`** | Thickness of the inner circle. | `3` |
| **`showsText`** | Whether or not to show a text representation of current progress. | `false` |
Expand Down