Skip to content

Commit e343ab4

Browse files
author
Markus Lindqvist
authored
Merge pull request #238 from aboveyunhai/master
fix PropTypes and update README
2 parents 2d0bc97 + 4750bb6 commit e343ab4

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,17 @@ width | number | **required** | Thick
9393
backgroundWidth | number | width | Thickness of background circle
9494
fill | number (0-100) | 0 | Current progress / fill
9595
tintColor | string | black | Color of the progress line
96+
tintTransparency | boolean | true | Transparency of the progress line
9697
backgroundColor | string | | If unspecified, no background line will be rendered
9798
rotation | number (-360 - 360) | 90 | Angle from which the progress starts from
9899
lineCap | string | butt | Shape used at ends of progress line. Possible values: butt, round, square
99100
arcSweepAngle | number (0-360) | 360 | If you don't want a full circle, specify the arc angle
100101
style | ViewPropTypes.style | | Extra styling for the main container
101-
children | function | | Pass a function as a child. It receiveds the current fill-value as an argument
102+
children | function | | Pass a function as a child. It received the current fill-value as an argument
102103
childrenContainerStyle| ViewPropTypes.style | | Extra styling for the children container
103104
padding | number | 0 | Padding applied around the circle to allow for a cap that bleeds outside its boundary
104105
dashedBackground | object | { width: 0, gap: 0 } | Bar background as dashed type
106+
dashedTint | object | { width: 0, gap: 0 } | Bar tint as dashed type
105107
renderCap | function | undefined | Function that's invoked during rendering to draw at the tip of the progress circle
106108

107109
The following props can further be used on `AnimatedCircularProgress`:

index.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ declare module 'react-native-circular-progress' {
3939
*/
4040
fill?: number;
4141

42-
/**
43-
* Current progress / fillTransparency
44-
*
45-
* @type {boolean}
46-
* @default true
47-
*/
48-
fillTransparency?: boolean;
49-
5042
/**
5143
* Color of the progress line
5244
*
@@ -63,6 +55,14 @@ declare module 'react-native-circular-progress' {
6355
*/
6456
tintColorSecondary?: string;
6557

58+
/**
59+
* Current progress / tint transparency
60+
*
61+
* @type {boolean}
62+
* @default true
63+
*/
64+
tintTransparency?: boolean;
65+
6666
/**
6767
* If unspecified, no background line will be rendered
6868
*
@@ -163,12 +163,12 @@ declare module 'react-native-circular-progress' {
163163
}) => React.ReactNode;
164164

165165
/**
166-
* Use dashed type for fill
166+
* Use dashed type for tint/progress line
167167
*
168168
* @type { width: number; gap: number }
169169
* @default '{ width: 0, gap: 0 }'
170170
*/
171-
dashedFill?: { width: number; gap: number };
171+
dashedTint?: { width: number; gap: number };
172172

173173
/**
174174
* Use dashed type for background

src/CircularProgress.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ export default class CircularProgress extends React.PureComponent {
2828
width,
2929
backgroundWidth,
3030
tintColor,
31+
tintTransparency,
3132
backgroundColor,
3233
style,
3334
rotation,
3435
lineCap,
3536
arcSweepAngle,
3637
fill,
37-
fillTransparency,
3838
children,
3939
childrenContainerStyle,
4040
padding,
4141
renderCap,
4242
dashedBackground,
43-
dashedFill
43+
dashedTint
4444
} = this.props;
4545

4646
const maxWidthCircle = backgroundWidth ? Math.max(width, backgroundWidth) : width;
@@ -52,7 +52,7 @@ export default class CircularProgress extends React.PureComponent {
5252
sizeWithPadding,
5353
sizeWithPadding,
5454
radius,
55-
fillTransparency ? 0 : currentFillAngle,
55+
tintTransparency ? 0 : currentFillAngle,
5656
arcSweepAngle
5757
);
5858
const circlePath = this.circlePath(
@@ -87,8 +87,8 @@ export default class CircularProgress extends React.PureComponent {
8787
...childrenContainerStyle,
8888
}
8989

90-
const strokeDasharrayFill = dashedFill.gap > 0 ?
91-
Object.values(dashedFill)
90+
const strokeDasharrayTint = dashedTint.gap > 0 ?
91+
Object.values(dashedTint)
9292
.map(value => parseInt(value))
9393
: null;
9494

@@ -117,7 +117,7 @@ export default class CircularProgress extends React.PureComponent {
117117
stroke={tintColor}
118118
strokeWidth={width}
119119
strokeLinecap={lineCap}
120-
strokeDasharray={strokeDasharrayFill}
120+
strokeDasharray={strokeDasharrayTint}
121121
fill="transparent"
122122
/>
123123
)}
@@ -134,10 +134,10 @@ CircularProgress.propTypes = {
134134
style: ViewPropTypes.style,
135135
size: PropTypes.number.isRequired,
136136
fill: PropTypes.number.isRequired,
137-
fillTransparency: PropTypes.boolean,
138137
width: PropTypes.number.isRequired,
139138
backgroundWidth: PropTypes.number,
140139
tintColor: PropTypes.string,
140+
tintTransparency: PropTypes.bool,
141141
backgroundColor: PropTypes.string,
142142
rotation: PropTypes.number,
143143
lineCap: PropTypes.string,
@@ -147,16 +147,16 @@ CircularProgress.propTypes = {
147147
padding: PropTypes.number,
148148
renderCap: PropTypes.func,
149149
dashedBackground: PropTypes.object,
150-
dashedFill: PropTypes.object
150+
dashedTint: PropTypes.object
151151
};
152152

153153
CircularProgress.defaultProps = {
154154
tintColor: 'black',
155+
tintTransparency: true,
155156
rotation: 90,
156157
lineCap: 'butt',
157158
arcSweepAngle: 360,
158159
padding: 0,
159160
dashedBackground: { width: 0, gap: 0 },
160-
dashedFill: { width: 0, gap: 0 },
161-
fillTransparency: true
161+
dashedTint: { width: 0, gap: 0 },
162162
};

0 commit comments

Comments
 (0)