@baby-journey/rn-segmented-progress-bar 0.1.5 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/helpers/index.js +4 -5
- package/lib/commonjs/helpers/index.js.map +1 -1
- package/lib/commonjs/index.js +198 -142
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/module/helpers/index.js +6 -5
- package/lib/module/helpers/index.js.map +1 -1
- package/lib/module/index.js +199 -139
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/helpers/index.d.ts +2 -2
- package/lib/typescript/helpers/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +23 -16
- package/src/helpers/index.ts +16 -9
- package/src/index.tsx +236 -190
- package/.editorconfig +0 -15
- package/.gitattributes +0 -3
- package/.gitignore +0 -70
- package/.nvmrc +0 -1
- package/.watchmanconfig +0 -1
- package/.yarnrc +0 -3
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -116
- package/babel.config.js +0 -3
- package/docs/CODE_OF_CONDUCT.md +0 -44
- package/docs/CONTRIBUTING.md +0 -95
- package/docs/pull_request_template.md +0 -28
- package/example/.expo/README.md +0 -8
- package/example/.expo/devices.json +0 -3
- package/example/App.js +0 -1
- package/example/app.json +0 -33
- package/example/assets/adaptive-icon.png +0 -0
- package/example/assets/favicon.png +0 -0
- package/example/assets/icon.png +0 -0
- package/example/assets/splash.png +0 -0
- package/example/babel.config.js +0 -22
- package/example/metro.config.js +0 -38
- package/example/package.json +0 -30
- package/example/src/App.tsx +0 -41
- package/example/tsconfig.json +0 -6
- package/example/webpack.config.js +0 -25
- package/example/yarn.lock +0 -10640
- package/lefthook.yml +0 -16
- package/scripts/bootstrap.js +0 -29
- package/src/__tests__/helper/index.test.js +0 -92
- package/src/__tests__/index.test.js +0 -28
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -28
- package/yarn.lock +0 -9933
package/lib/module/index.js
CHANGED
|
@@ -1,12 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
3
4
|
import { Animated, Easing, StyleSheet, View } from 'react-native';
|
|
4
5
|
import Svg, { Circle, G, TSpan } from 'react-native-svg';
|
|
5
6
|
import { getArcEndCoordinates, getPathValues } from './helpers';
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
8
|
const IndicatorCircle = Animated.createAnimatedComponent(Circle);
|
|
7
9
|
const ProgressCircle = Animated.createAnimatedComponent(Circle);
|
|
8
10
|
const max = 100;
|
|
9
11
|
const duration = 1200;
|
|
12
|
+
const progressDelay = 500;
|
|
13
|
+
const INDICATOR_FONT = {
|
|
14
|
+
textAnchor: 'middle',
|
|
15
|
+
fontSize: 18
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Computes the declarative strokeDashoffset for a segment.
|
|
20
|
+
* Returns an Animated.AnimatedInterpolation when the segment has progress,
|
|
21
|
+
* or a static number when it doesn't.
|
|
22
|
+
*/
|
|
23
|
+
const computeStrokeDashoffset = (animatedVal, target, circumference, numSegments, gap) => {
|
|
24
|
+
if (target <= 0) return circumference;
|
|
25
|
+
const gapAdjust = numSegments * target * gap / 100;
|
|
26
|
+
const targetOffset = circumference * (1 - target / 100) + gapAdjust;
|
|
27
|
+
const thresholdV = gapAdjust > 0 ? gapAdjust * 100 / circumference : 0;
|
|
28
|
+
|
|
29
|
+
// Gap consumes all progress — segment stays hidden
|
|
30
|
+
if (thresholdV >= target) return circumference;
|
|
31
|
+
|
|
32
|
+
// With gap: dead zone at start where offset stays at circumference
|
|
33
|
+
if (thresholdV > 0) {
|
|
34
|
+
return animatedVal.interpolate({
|
|
35
|
+
inputRange: [0, thresholdV, target],
|
|
36
|
+
outputRange: [circumference, circumference, targetOffset],
|
|
37
|
+
extrapolate: 'clamp'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// No gap: simple linear interpolation
|
|
42
|
+
return animatedVal.interpolate({
|
|
43
|
+
inputRange: [0, target],
|
|
44
|
+
outputRange: [circumference, targetOffset],
|
|
45
|
+
extrapolate: 'clamp'
|
|
46
|
+
});
|
|
47
|
+
};
|
|
10
48
|
const RNSegmentedProgressBar = (props, ref) => {
|
|
11
49
|
const {
|
|
12
50
|
radius,
|
|
@@ -18,181 +56,203 @@ const RNSegmentedProgressBar = (props, ref) => {
|
|
|
18
56
|
indicator,
|
|
19
57
|
centerComponent
|
|
20
58
|
} = props;
|
|
21
|
-
const circleRef = useRef([]);
|
|
22
59
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
23
|
-
const progressAnimatedValues = useRef(
|
|
60
|
+
const progressAnimatedValues = useRef(new Array(segments).fill(null).map(() => new Animated.Value(0))).current;
|
|
24
61
|
const indicatorCircleRef = useRef(null);
|
|
25
62
|
const tSpanRef = useRef(null);
|
|
26
|
-
|
|
63
|
+
|
|
64
|
+
// Per-segment target values — drives both render-time interpolation and animation
|
|
65
|
+
const [segmentTargets, setSegmentTargets] = useState(() => new Array(segments).fill(0));
|
|
66
|
+
// Overall progress stored in ref (only needed inside animation, not for render)
|
|
67
|
+
const activeProgressRef = useRef(0);
|
|
68
|
+
// Pending animation config — bridges run() and the post-render effect
|
|
69
|
+
const pendingAnimationRef = useRef(null);
|
|
70
|
+
const indicatorSegmentsGap = indicator?.radius ?? 0;
|
|
27
71
|
const halfCircle = radius + strokeWidth + indicatorSegmentsGap;
|
|
28
72
|
const circleCircumference = 2 * Math.PI * radius;
|
|
29
73
|
const rotation = -90 + 180 * (segmentsGap / 2 / radius) / Math.PI;
|
|
30
74
|
const getProgressValues = useCallback(progress => getPathValues(progress, max, segments), [segments]);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
easing: Easing.linear
|
|
39
|
-
});
|
|
40
|
-
}, []);
|
|
75
|
+
const getMeanSegmentsGap = useCallback(progress => {
|
|
76
|
+
const pathValues = getProgressValues(progress);
|
|
77
|
+
const activeSegments = pathValues.filter(val => val > 0).length;
|
|
78
|
+
return progress / (activeSegments || 1) * segments * segmentsGap / 100;
|
|
79
|
+
}, [getProgressValues, segments, segmentsGap]);
|
|
80
|
+
|
|
81
|
+
// Clean up on unmount
|
|
41
82
|
useEffect(() => {
|
|
42
|
-
() => {
|
|
83
|
+
return () => {
|
|
84
|
+
animatedValue.stopAnimation();
|
|
43
85
|
animatedValue.removeAllListeners();
|
|
44
|
-
progressAnimatedValues.forEach(
|
|
86
|
+
progressAnimatedValues.forEach(v => {
|
|
87
|
+
v.stopAnimation();
|
|
88
|
+
v.removeAllListeners();
|
|
89
|
+
});
|
|
45
90
|
};
|
|
46
91
|
}, [animatedValue, progressAnimatedValues]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
92
|
+
|
|
93
|
+
// Start animations AFTER React has re-rendered with updated segmentTargets.
|
|
94
|
+
// This guarantees progressTrack useMemo has correct interpolations before
|
|
95
|
+
// any animated values start ticking.
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
const pending = pendingAnimationRef.current;
|
|
98
|
+
if (!pending) return;
|
|
99
|
+
pendingAnimationRef.current = null;
|
|
52
100
|
const {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} =
|
|
56
|
-
|
|
57
|
-
|
|
101
|
+
progress,
|
|
102
|
+
targets
|
|
103
|
+
} = pending;
|
|
104
|
+
const progressAnimations = Animated.sequence(progressAnimatedValues.map((animVal, index) => Animated.timing(animVal, {
|
|
105
|
+
toValue: targets[index] ?? 0,
|
|
106
|
+
duration: duration * (targets[index] ?? 0) / max,
|
|
107
|
+
delay: index === 0 ? progressDelay : 0,
|
|
108
|
+
useNativeDriver: false,
|
|
109
|
+
easing: Easing.linear
|
|
110
|
+
})));
|
|
111
|
+
if (indicator?.show) {
|
|
112
|
+
const percentageAnim = Animated.timing(animatedValue, {
|
|
113
|
+
toValue: progress,
|
|
114
|
+
duration: duration * progress / max,
|
|
115
|
+
delay: progressDelay,
|
|
116
|
+
useNativeDriver: false,
|
|
117
|
+
easing: Easing.linear
|
|
118
|
+
});
|
|
119
|
+
Animated.parallel([progressAnimations, percentageAnim]).start();
|
|
120
|
+
} else {
|
|
121
|
+
progressAnimations.start();
|
|
58
122
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
123
|
+
}, [segmentTargets, animatedValue, indicator?.show, progressAnimatedValues]);
|
|
124
|
+
const run = useCallback(({
|
|
125
|
+
progress
|
|
126
|
+
}) => {
|
|
127
|
+
// Stop ongoing animations and clear all listeners
|
|
128
|
+
animatedValue.stopAnimation();
|
|
129
|
+
animatedValue.removeAllListeners();
|
|
130
|
+
animatedValue.setValue(0);
|
|
131
|
+
progressAnimatedValues.forEach(v => {
|
|
132
|
+
v.stopAnimation();
|
|
133
|
+
v.removeAllListeners();
|
|
134
|
+
v.setValue(0);
|
|
135
|
+
});
|
|
136
|
+
const targets = getProgressValues(progress);
|
|
137
|
+
activeProgressRef.current = progress;
|
|
138
|
+
|
|
139
|
+
// Set up indicator static properties once (not per-frame)
|
|
140
|
+
if (indicator?.show && indicatorCircleRef.current && tSpanRef.current) {
|
|
141
|
+
const calculatedProgress = `${Math.round(progress)}%`;
|
|
142
|
+
// @ts-ignore – setNativeProps exists on native ref
|
|
62
143
|
indicatorCircleRef.current.setNativeProps({
|
|
63
|
-
r:
|
|
64
|
-
strokeWidth:
|
|
65
|
-
cx,
|
|
66
|
-
cy
|
|
144
|
+
r: indicator.radius || 0,
|
|
145
|
+
strokeWidth: indicator.strokeWidth || 0
|
|
67
146
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
tSpanRef === null || tSpanRef === void 0 ? void 0 : tSpanRef.current.setNativeProps({
|
|
147
|
+
// @ts-ignore – setNativeProps exists on native ref
|
|
148
|
+
tSpanRef.current.setNativeProps({
|
|
71
149
|
children: calculatedProgress,
|
|
72
|
-
|
|
73
|
-
dy: cy + 5,
|
|
74
|
-
font: {
|
|
75
|
-
textAnchor: 'middle',
|
|
76
|
-
fontSize: 18
|
|
77
|
-
}
|
|
150
|
+
font: INDICATOR_FONT
|
|
78
151
|
});
|
|
79
152
|
}
|
|
80
|
-
}, [radius, halfCircle, rotation, indicator === null || indicator === void 0 ? void 0 : indicator.radius, indicator === null || indicator === void 0 ? void 0 : indicator.strokeWidth]);
|
|
81
|
-
const run = useCallback(_ref => {
|
|
82
|
-
let {
|
|
83
|
-
progress
|
|
84
|
-
} = _ref;
|
|
85
|
-
const circleProgressValues = getProgressValues(progress);
|
|
86
|
-
progressAnimatedValues.forEach((progressAnimated, index) => {
|
|
87
|
-
progressAnimated.addListener(v => {
|
|
88
|
-
if (circleRef !== null && circleRef !== void 0 && circleRef.current[index]) {
|
|
89
|
-
var _circleRef$current$in;
|
|
90
|
-
var strokeDashoffset = circleCircumference;
|
|
91
|
-
var val = v.value <= (circleProgressValues[index] ?? 0) ? v.value : circleProgressValues[index] ?? 0;
|
|
92
|
-
strokeDashoffset = circleProgressValues[index] ? circleCircumference - circleCircumference * val / 100 : circleCircumference;
|
|
93
|
-
const paintedLength = circleCircumference - strokeDashoffset - segments * (circleProgressValues[index] ?? 0) * segmentsGap / 100;
|
|
94
153
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
154
|
+
// Set up indicator position listener (trig-based, can't use interpolate)
|
|
155
|
+
if (indicator?.show) {
|
|
156
|
+
const meanGap = getMeanSegmentsGap(progress);
|
|
157
|
+
animatedValue.addListener(v => {
|
|
158
|
+
const val = Math.min(v.value, progress);
|
|
159
|
+
const paintedLength = circleCircumference * val / 100;
|
|
160
|
+
const adjustedLength = paintedLength - meanGap;
|
|
161
|
+
if (adjustedLength <= 0) return;
|
|
162
|
+
const {
|
|
163
|
+
x: cx,
|
|
164
|
+
y: cy
|
|
165
|
+
} = getArcEndCoordinates(radius, adjustedLength, halfCircle, halfCircle, rotation);
|
|
166
|
+
if (indicatorCircleRef.current) {
|
|
167
|
+
// @ts-ignore – setNativeProps exists on native ref
|
|
168
|
+
indicatorCircleRef.current.setNativeProps({
|
|
169
|
+
cx,
|
|
170
|
+
cy
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (tSpanRef.current) {
|
|
174
|
+
// @ts-ignore – setNativeProps exists on native ref
|
|
175
|
+
tSpanRef.current.setNativeProps({
|
|
176
|
+
dx: cx,
|
|
177
|
+
dy: cy + 5
|
|
98
178
|
});
|
|
99
179
|
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
if (indicator !== null && indicator !== void 0 && indicator.show) {
|
|
103
|
-
animatedValue.addListener(v => {
|
|
104
|
-
var strokeDashoffset = circleCircumference;
|
|
105
|
-
var val = v.value <= progress ? v.value : progress;
|
|
106
|
-
strokeDashoffset = progress ? circleCircumference - circleCircumference * val / 100 : circleCircumference;
|
|
107
|
-
const paintedLength = circleCircumference - strokeDashoffset;
|
|
108
|
-
const meanSegmentsGap = getMeanSegmentsGap(progress);
|
|
109
|
-
const calculatedStrokeDashoffset = paintedLength - meanSegmentsGap;
|
|
110
|
-
runIndicator(calculatedStrokeDashoffset, progress);
|
|
111
180
|
});
|
|
112
181
|
}
|
|
113
182
|
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
// To value
|
|
119
|
-
index === 0 ? progressDelay : 0,
|
|
120
|
-
// Delay
|
|
121
|
-
duration * (circleProgressValues[index] ?? 0) / max // Duration
|
|
122
|
-
)));
|
|
123
|
-
|
|
124
|
-
if (indicator !== null && indicator !== void 0 && indicator.show) {
|
|
125
|
-
// Animate percentage circle
|
|
126
|
-
const percentageAnim = animation(animatedValue,
|
|
127
|
-
// Animated value
|
|
183
|
+
// Store pending config and trigger re-render with new targets.
|
|
184
|
+
// Animations start in a useEffect AFTER React has re-rendered,
|
|
185
|
+
// ensuring interpolations in progressTrack are set up correctly.
|
|
186
|
+
pendingAnimationRef.current = {
|
|
128
187
|
progress,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
}, [animatedValue, animation, segments, circleCircumference, segmentsGap, getMeanSegmentsGap, indicator === null || indicator === void 0 ? void 0 : indicator.show, getProgressValues, runIndicator, progressAnimatedValues]);
|
|
140
|
-
const getProgress = useMemo(() => {
|
|
141
|
-
const progressConfig = {
|
|
142
|
-
stroke: progressColor,
|
|
188
|
+
targets
|
|
189
|
+
};
|
|
190
|
+
setSegmentTargets(targets);
|
|
191
|
+
}, [animatedValue, circleCircumference, getMeanSegmentsGap, getProgressValues, halfCircle, indicator?.show, indicator?.radius, indicator?.strokeWidth, progressAnimatedValues, radius, rotation]);
|
|
192
|
+
|
|
193
|
+
// Memoize base track circles (static, never animate)
|
|
194
|
+
const baseTrack = useMemo(() => {
|
|
195
|
+
const baseStrokeDashoffset = circleCircumference - circleCircumference / segments + segmentsGap;
|
|
196
|
+
return new Array(segments).fill(null).map((_, key) => /*#__PURE__*/_jsx(Circle, {
|
|
143
197
|
cx: halfCircle,
|
|
144
198
|
cy: halfCircle,
|
|
145
199
|
r: radius,
|
|
200
|
+
stroke: baseColor,
|
|
201
|
+
rotation: rotation + key * 360 / segments,
|
|
146
202
|
origin: `${halfCircle}, ${halfCircle}`,
|
|
147
203
|
strokeWidth: strokeWidth,
|
|
148
204
|
strokeDasharray: circleCircumference,
|
|
149
|
-
strokeDashoffset:
|
|
150
|
-
};
|
|
151
|
-
return progressAnimatedValues.map((_, key) => /*#__PURE__*/React.createElement(ProgressCircle, _extends({
|
|
152
|
-
key: key
|
|
153
|
-
//@ts-ignore
|
|
154
|
-
,
|
|
155
|
-
ref: el => circleRef.current[key] = el
|
|
156
|
-
}, progressConfig, {
|
|
157
|
-
rotation: rotation + key * 360 / segments,
|
|
205
|
+
strokeDashoffset: baseStrokeDashoffset,
|
|
158
206
|
strokeLinecap: "round"
|
|
159
|
-
}))
|
|
160
|
-
}, [
|
|
207
|
+
}, key));
|
|
208
|
+
}, [baseColor, circleCircumference, halfCircle, radius, rotation, segments, segmentsGap, strokeWidth]);
|
|
209
|
+
|
|
210
|
+
// Memoize progress overlay circles with declarative interpolated strokeDashoffset
|
|
211
|
+
const progressTrack = useMemo(() => {
|
|
212
|
+
return progressAnimatedValues.map((animVal, key) => {
|
|
213
|
+
const target = segmentTargets[key] ?? 0;
|
|
214
|
+
const strokeDashoffset = computeStrokeDashoffset(animVal, target, circleCircumference, segments, segmentsGap);
|
|
215
|
+
return /*#__PURE__*/_jsx(ProgressCircle, {
|
|
216
|
+
stroke: progressColor,
|
|
217
|
+
cx: halfCircle,
|
|
218
|
+
cy: halfCircle,
|
|
219
|
+
r: radius,
|
|
220
|
+
origin: `${halfCircle}, ${halfCircle}`,
|
|
221
|
+
strokeWidth: strokeWidth,
|
|
222
|
+
strokeDasharray: circleCircumference,
|
|
223
|
+
strokeDashoffset: strokeDashoffset,
|
|
224
|
+
rotation: rotation + key * 360 / segments,
|
|
225
|
+
strokeLinecap: "round"
|
|
226
|
+
}, key);
|
|
227
|
+
});
|
|
228
|
+
}, [circleCircumference, halfCircle, progressAnimatedValues, progressColor, radius, rotation, segmentTargets, segments, segmentsGap, strokeWidth]);
|
|
161
229
|
useImperativeHandle(ref, () => ({
|
|
162
230
|
run
|
|
163
|
-
}));
|
|
164
|
-
return /*#__PURE__*/
|
|
231
|
+
}), [run]);
|
|
232
|
+
return /*#__PURE__*/_jsxs(Svg, {
|
|
165
233
|
viewBox: `0 0 ${halfCircle * 2} ${halfCircle * 2}`,
|
|
166
234
|
width: '100%',
|
|
167
235
|
fill: "none",
|
|
168
|
-
height: radius * 2
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
})
|
|
185
|
-
})
|
|
186
|
-
stroke: progressColor,
|
|
187
|
-
ref: indicatorCircleRef,
|
|
188
|
-
fill: "white"
|
|
189
|
-
}), /*#__PURE__*/React.createElement(TSpan, {
|
|
190
|
-
stroke: progressColor,
|
|
191
|
-
fill: progressColor,
|
|
192
|
-
ref: tSpanRef
|
|
193
|
-
}))));
|
|
236
|
+
height: radius * 2,
|
|
237
|
+
children: [centerComponent && /*#__PURE__*/_jsx(View, {
|
|
238
|
+
style: styles.centerComponent,
|
|
239
|
+
children: centerComponent
|
|
240
|
+
}), /*#__PURE__*/_jsxs(G, {
|
|
241
|
+
children: [baseTrack, progressTrack, indicator?.show === true && /*#__PURE__*/_jsxs(_Fragment, {
|
|
242
|
+
children: [/*#__PURE__*/_jsx(IndicatorCircle, {
|
|
243
|
+
stroke: progressColor,
|
|
244
|
+
ref: indicatorCircleRef,
|
|
245
|
+
fill: "white"
|
|
246
|
+
}), /*#__PURE__*/_jsx(TSpan, {
|
|
247
|
+
stroke: progressColor,
|
|
248
|
+
fill: progressColor,
|
|
249
|
+
ref: tSpanRef
|
|
250
|
+
})]
|
|
251
|
+
})]
|
|
252
|
+
})]
|
|
253
|
+
});
|
|
194
254
|
};
|
|
195
|
-
export default /*#__PURE__*/memo(
|
|
255
|
+
export default /*#__PURE__*/memo(/*#__PURE__*/forwardRef(RNSegmentedProgressBar));
|
|
196
256
|
const styles = StyleSheet.create({
|
|
197
257
|
centerComponent: {
|
|
198
258
|
height: '100%',
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","memo","useCallback","useEffect","useImperativeHandle","useMemo","useRef","Animated","Easing","StyleSheet","View","Svg","Circle","G","TSpan","getArcEndCoordinates","getPathValues","IndicatorCircle","createAnimatedComponent","ProgressCircle","max","duration","RNSegmentedProgressBar","props","ref","radius","strokeWidth","baseColor","progressColor","segments","segmentsGap","indicator","centerComponent","circleRef","animatedValue","Value","current","progressAnimatedValues","Array","map","indicatorCircleRef","tSpanRef","indicatorSegmentsGap","halfCircle","circleCircumference","Math","PI","rotation","getProgressValues","progress","progressDelay","animation","animatedVal","toValue","delay","durationValue","timing","useNativeDriver","easing","linear","removeAllListeners","forEach","progressAnimatedValue","getMeanSegmentsGap","pathValues","filter","val","length","runIndicator","calculatedStrokeDashoffset","x","cx","y","cy","calculatedProgress","round","setNativeProps","r","children","dx","dy","font","textAnchor","fontSize","run","circleProgressValues","progressAnimated","index","addListener","v","strokeDashoffset","value","paintedLength","show","meanSegmentsGap","progressAnimations","sequence","tav","percentageAnim","parallel","start","getProgress","progressConfig","stroke","origin","strokeDasharray","_","key","el","styles","create","height","justifyContent","alignItems"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EAEVC,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,SAASC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,GAAG,IAAIC,MAAM,EAAEC,CAAC,EAAEC,KAAK,QAAQ,kBAAkB;AACxD,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,WAAW;AAwB/D,MAAMC,eAAe,GAAGV,QAAQ,CAACW,uBAAuB,CAACN,MAAM,CAAC;AAChE,MAAMO,cAAc,GAAGZ,QAAQ,CAACW,uBAAuB,CAACN,MAAM,CAAC;AAE/D,MAAMQ,GAAG,GAAG,GAAG;AACf,MAAMC,QAAQ,GAAG,IAAI;AAErB,MAAMC,sBAGL,GA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Q,EAAEoB,QAAQ,GAAI4D,GAAG,GAAG,GAAG,GAAI9E,QAAS;MAC5C,MAAM,EAAG,GAAEc,UAAW,KAAIA,UAAW,EAAE;MACvC,WAAW,EAAEjB,WAAY;MACzB,eAAe,EAAEkB,mBAAoB;MACrC,gBAAgB,EACdA,mBAAmB,GACnBA,mBAAmB,GAAGf,QAAQ,GAC9BC,WACD;MACD,aAAa,EAAC;IAAO,EACrB;EAEN,CAAC,CAAC,EACDuE,WAAW,EAEX,CAAAtE,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAE8D,IAAI,MAAK,IAAI,iBACvB,uDACE,oBAAC,eAAe;IACd,MAAM,EAAEjE,aAAc;IACtB,GAAG,EAAEY,kBAAmB;IACxB,IAAI,EAAC;EAAO,EACZ,eACF,oBAAC,KAAK;IAAC,MAAM,EAAEZ,aAAc;IAAC,IAAI,EAAEA,aAAc;IAAC,GAAG,EAAEa;EAAS,EAAG,CAEvE,CACC,CACA;AAEV,CAAC;AAED,4BAAexC,IAAI,eAACD,UAAU,CAACsB,sBAAsB,CAAC,CAAC;AAEvD,MAAMuF,MAAM,GAAGpG,UAAU,CAACqG,MAAM,CAAC;EAC/B9E,eAAe,EAAE;IACf+E,MAAM,EAAE,MAAM;IACdC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["forwardRef","memo","useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","Animated","Easing","StyleSheet","View","Svg","Circle","G","TSpan","getArcEndCoordinates","getPathValues","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","IndicatorCircle","createAnimatedComponent","ProgressCircle","max","duration","progressDelay","INDICATOR_FONT","textAnchor","fontSize","computeStrokeDashoffset","animatedVal","target","circumference","numSegments","gap","gapAdjust","targetOffset","thresholdV","interpolate","inputRange","outputRange","extrapolate","RNSegmentedProgressBar","props","ref","radius","strokeWidth","baseColor","progressColor","segments","segmentsGap","indicator","centerComponent","animatedValue","Value","current","progressAnimatedValues","Array","fill","map","indicatorCircleRef","tSpanRef","segmentTargets","setSegmentTargets","activeProgressRef","pendingAnimationRef","indicatorSegmentsGap","halfCircle","circleCircumference","Math","PI","rotation","getProgressValues","progress","getMeanSegmentsGap","pathValues","activeSegments","filter","val","length","stopAnimation","removeAllListeners","forEach","v","pending","targets","progressAnimations","sequence","animVal","index","timing","toValue","delay","useNativeDriver","easing","linear","show","percentageAnim","parallel","start","run","setValue","calculatedProgress","round","setNativeProps","r","children","font","meanGap","addListener","min","value","paintedLength","adjustedLength","x","cx","y","cy","dx","dy","baseTrack","baseStrokeDashoffset","_","key","stroke","origin","strokeDasharray","strokeDashoffset","strokeLinecap","progressTrack","viewBox","width","height","style","styles","create","justifyContent","alignItems"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,UAAU,EAEVC,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,GAAG,IAAIC,MAAM,EAAEC,CAAC,EAAEC,KAAK,QAAQ,kBAAkB;AACxD,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAwBhE,MAAMC,eAAe,GAAGhB,QAAQ,CAACiB,uBAAuB,CAACZ,MAAM,CAAC;AAChE,MAAMa,cAAc,GAAGlB,QAAQ,CAACiB,uBAAuB,CAACZ,MAAM,CAAC;AAE/D,MAAMc,GAAG,GAAG,GAAG;AACf,MAAMC,QAAQ,GAAG,IAAI;AACrB,MAAMC,aAAa,GAAG,GAAG;AAEzB,MAAMC,cAAc,GAAG;EACrBC,UAAU,EAAE,QAAiB;EAC7BC,QAAQ,EAAE;AAC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,IAAI;MAAC8H,KAAK,EAAEC,MAAM,CAAClF,eAAgB;MAAAsD,QAAA,EAAEtD;IAAe,CAAO,CAC7D,eACDjC,KAAA,CAACT,CAAC;MAAAgG,QAAA,GACCc,SAAS,EACTS,aAAa,EAEb9E,SAAS,EAAE6C,IAAI,KAAK,IAAI,iBACvB7E,KAAA,CAAAF,SAAA;QAAAyF,QAAA,gBACE3F,IAAA,CAACK,eAAe;UACdwG,MAAM,EAAE5E,aAAc;UACtBJ,GAAG,EAAEgB,kBAAmB;UACxBF,IAAI,EAAC;QAAO,CACb,CAAC,eACF3C,IAAA,CAACJ,KAAK;UAACiH,MAAM,EAAE5E,aAAc;UAACU,IAAI,EAAEV,aAAc;UAACJ,GAAG,EAAEiB;QAAS,CAAE,CAAC;MAAA,CACpE,CACH;IAAA,CACA,CAAC;EAAA,CACD,CAAC;AAEV,CAAC;AAED,4BAAehE,IAAI,cAACD,UAAU,CAAC8C,sBAAsB,CAAC,CAAC;AAEvD,MAAM4F,MAAM,GAAGhI,UAAU,CAACiI,MAAM,CAAC;EAC/BnF,eAAe,EAAE;IACfgF,MAAM,EAAE,MAAM;IACdI,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const getPathValues: (progress: number | undefined, max: number, segments: number) => number[];
|
|
2
|
-
export declare const getArcEndCoordinates: (radius: number, circleCircumference: number, cx: number, cy: number, rotation?: number) => {
|
|
1
|
+
export declare const getPathValues: (progress: number | null | undefined, max: number, segments: number) => number[];
|
|
2
|
+
export declare const getArcEndCoordinates: (radius: number | null | undefined, circleCircumference: number | null | undefined, cx: number | null | undefined, cy: number | null | undefined, rotation?: number) => {
|
|
3
3
|
x: number;
|
|
4
4
|
y: number;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GACxB,UAAU,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,KAAK,MAAM,EACX,UAAU,MAAM,KACf,MAAM,EAsBR,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,qBAAqB,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9C,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,WAAU,MAAU,KACnB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAiBxB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
interface Indicator {
|
|
3
2
|
show?: boolean;
|
|
4
3
|
radius?: number;
|
|
@@ -20,6 +19,6 @@ export type RunAnimationHandler = {
|
|
|
20
19
|
progress: number;
|
|
21
20
|
}) => void;
|
|
22
21
|
};
|
|
23
|
-
declare const _default:
|
|
22
|
+
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<RNSegmentedProgressBarProps & import("react").RefAttributes<RunAnimationHandler>>>;
|
|
24
23
|
export default _default;
|
|
25
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAeA,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,2BAA2B;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACnD,CAAC;;AAsVF,wBAAwD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baby-journey/rn-segmented-progress-bar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Animated circular progress bar with segments",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -62,39 +62,41 @@
|
|
|
62
62
|
"@evilmartians/lefthook": "^1.2.2",
|
|
63
63
|
"@react-native-community/eslint-config": "^3.0.2",
|
|
64
64
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
65
|
-
"@testing-library/jest-native": "^5.4.
|
|
66
|
-
"@testing-library/react-native": "^11.5.
|
|
67
|
-
"@types/jest": "^
|
|
68
|
-
"@types/react": "
|
|
65
|
+
"@testing-library/jest-native": "^5.4.3",
|
|
66
|
+
"@testing-library/react-native": "^11.5.4",
|
|
67
|
+
"@types/jest": "^29.5.0",
|
|
68
|
+
"@types/react": "18.2.79",
|
|
69
69
|
"@types/react-native": "0.70.0",
|
|
70
70
|
"commitlint": "^17.0.2",
|
|
71
71
|
"del-cli": "^5.0.0",
|
|
72
72
|
"eslint": "^8.4.1",
|
|
73
|
-
"eslint-config-prettier": "^
|
|
74
|
-
"eslint-plugin-
|
|
73
|
+
"eslint-config-prettier": "^9.1.0",
|
|
74
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
75
|
+
"eslint-plugin-prettier": "^5.2.0",
|
|
75
76
|
"jest": "^28.1.1",
|
|
77
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
76
78
|
"pod-install": "^0.1.0",
|
|
77
|
-
"prettier": "^
|
|
79
|
+
"prettier": "^3.5.0",
|
|
78
80
|
"react": "18.1.0",
|
|
79
81
|
"react-native": "0.70.5",
|
|
80
|
-
"react-native-builder-bob": "^0.
|
|
81
|
-
"react-native-svg": "^
|
|
82
|
+
"react-native-builder-bob": "^0.40.0",
|
|
83
|
+
"react-native-svg": "^15.11.0",
|
|
82
84
|
"react-test-renderer": "^18.2.0",
|
|
83
85
|
"release-it": "^15.0.0",
|
|
84
|
-
"typescript": "^
|
|
86
|
+
"typescript": "^5.7.0"
|
|
85
87
|
},
|
|
86
88
|
"resolutions": {
|
|
87
|
-
"@types/react": "
|
|
89
|
+
"@types/react": "18.2.79"
|
|
88
90
|
},
|
|
89
91
|
"peerDependencies": {
|
|
90
92
|
"react": "*",
|
|
91
93
|
"react-native": "*",
|
|
92
|
-
"react-native-svg": "
|
|
94
|
+
"react-native-svg": ">= 13.7.0"
|
|
93
95
|
},
|
|
94
96
|
"engines": {
|
|
95
|
-
"node": ">=
|
|
97
|
+
"node": ">= 18.0.0"
|
|
96
98
|
},
|
|
97
|
-
"packageManager": "
|
|
99
|
+
"packageManager": "yarn@1.22.22",
|
|
98
100
|
"jest": {
|
|
99
101
|
"preset": "react-native",
|
|
100
102
|
"setupFilesAfterEnv": [
|
|
@@ -103,7 +105,11 @@
|
|
|
103
105
|
"modulePathIgnorePatterns": [
|
|
104
106
|
"<rootDir>/example/node_modules",
|
|
105
107
|
"<rootDir>/lib/"
|
|
106
|
-
]
|
|
108
|
+
],
|
|
109
|
+
"testEnvironment": "node",
|
|
110
|
+
"globals": {
|
|
111
|
+
"performance": {}
|
|
112
|
+
}
|
|
107
113
|
},
|
|
108
114
|
"commitlint": {
|
|
109
115
|
"extends": [
|
|
@@ -134,6 +140,7 @@
|
|
|
134
140
|
"prettier"
|
|
135
141
|
],
|
|
136
142
|
"rules": {
|
|
143
|
+
"react/react-in-jsx-scope": "off",
|
|
137
144
|
"prettier/prettier": [
|
|
138
145
|
"error",
|
|
139
146
|
{
|
package/src/helpers/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export const getPathValues = (
|
|
2
|
-
progress: number | undefined,
|
|
2
|
+
progress: number | null | undefined,
|
|
3
3
|
max: number,
|
|
4
4
|
segments: number
|
|
5
5
|
): number[] => {
|
|
6
6
|
if (!progress) {
|
|
7
|
-
return
|
|
7
|
+
return new Array(segments).fill(0);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const pathLengths = [];
|
|
10
|
+
const pathLengths: number[] = [];
|
|
11
11
|
|
|
12
12
|
if (progress > max) {
|
|
13
13
|
progress = max;
|
|
@@ -18,7 +18,7 @@ export const getPathValues = (
|
|
|
18
18
|
let i = 0;
|
|
19
19
|
while (i < segments) {
|
|
20
20
|
const val: number = progress >= max / segments ? max / segments : progress;
|
|
21
|
-
pathLengths.push(
|
|
21
|
+
pathLengths.push(Math.round(val * 10000) / 10000);
|
|
22
22
|
progress = progress - val;
|
|
23
23
|
i++;
|
|
24
24
|
}
|
|
@@ -27,13 +27,20 @@ export const getPathValues = (
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const getArcEndCoordinates = (
|
|
30
|
-
radius: number,
|
|
31
|
-
circleCircumference: number,
|
|
32
|
-
cx: number,
|
|
33
|
-
cy: number,
|
|
30
|
+
radius: number | null | undefined,
|
|
31
|
+
circleCircumference: number | null | undefined,
|
|
32
|
+
cx: number | null | undefined,
|
|
33
|
+
cy: number | null | undefined,
|
|
34
34
|
rotation: number = 0
|
|
35
35
|
): { x: number; y: number } => {
|
|
36
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
circleCircumference == null ||
|
|
38
|
+
circleCircumference === 0 ||
|
|
39
|
+
radius == null ||
|
|
40
|
+
radius === 0 ||
|
|
41
|
+
cx == null ||
|
|
42
|
+
cy == null
|
|
43
|
+
) {
|
|
37
44
|
return { x: 0, y: 0 };
|
|
38
45
|
}
|
|
39
46
|
|