148 lines
5.2 KiB
React
148 lines
5.2 KiB
React
// Metro module 14085 (f14086).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import _possibleConstructorReturn from "./_possibleConstructorReturn";
|
|
import _getPrototypeOf from "./_getPrototypeOf";
|
|
import _inherits from "./_inherits";
|
|
import Module19 from "react";
|
|
import { Animated, View } from "react-native";
|
|
import { Path, Svg, G } from "./Module8531";
|
|
import Module12253 from "./Module12253";
|
|
let CircularProgress;
|
|
let env9850 = {};
|
|
env9850[8] = function _isNativeReflectConstruct() {
|
|
let c20890_0;
|
|
try {
|
|
c20890_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
} catch ($e) {}
|
|
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
|
|
return !!c20890_0;
|
|
};
|
|
env9850[8] = _isNativeReflectConstruct2;
|
|
return _isNativeReflectConstruct2();
|
|
};
|
|
const PureComponent = Module19.PureComponent;
|
|
CircularProgress = function CircularProgress(...args) {
|
|
_classCallCheck(this, CircularProgress);
|
|
const r9 = [...args];
|
|
const r8 = _getPrototypeOf(CircularProgress);
|
|
const r26 = _possibleConstructorReturn(this, (0, env9850[8])() ? Reflect.construct(r8, r9, _getPrototypeOf(this).constructor) : r8.apply(this, r9));
|
|
r26.clampFill = (a0) => Math.min(100, Math.max(0, a0));
|
|
return r26;
|
|
};
|
|
_inherits(CircularProgress, PureComponent);
|
|
const r45 = _createClass(CircularProgress, [{
|
|
key: "polarToCartesian",
|
|
value: function polarToCartesian(a0, a1, a2, a3) {
|
|
const r11 = (a3 - 90) * Math.PI / 180;
|
|
return {
|
|
x: a0 + a2 * Math.cos(r11),
|
|
y: a1 + a2 * Math.sin(r11)
|
|
};
|
|
}
|
|
}, {
|
|
key: "circlePath",
|
|
value: function circlePath(a0, a1, a2, a3, a4) {
|
|
const r5 = this.polarToCartesian(a0, a1, a2, 0.9999999 * a4);
|
|
const r20 = this.polarToCartesian(a0, a1, a2, a3);
|
|
return ["M", r5.x, r5.y, "A", a2, a2, 0, a4 - a3 <= 180 ? "0" : "1", 0, r20.x, r20.y].join(" ");
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
const props = this.props;
|
|
const { size, width } = props;
|
|
let backgroundWidth = props.backgroundWidth;
|
|
const { tintColor, tintTransparency, backgroundColor, style, rotation, lineCap, fillLineCap = lineCap, arcSweepAngle, fill, children, childrenContainerStyle, padding } = props;
|
|
props.renderCap;
|
|
const { dashedBackground, dashedTint } = props;
|
|
const r45 = backgroundWidth ? Math.max(width, backgroundWidth) : width;
|
|
const r6 = size / 2;
|
|
const r1 = padding / 2;
|
|
const r7 = size / 2;
|
|
const r0 = r45 / 2;
|
|
const r8 = padding / 2;
|
|
const r5 = arcSweepAngle * this.clampFill(fill) / 100;
|
|
const circlePath2 = this.circlePath;
|
|
const r4 = tintTransparency ? 0 : r5;
|
|
const r52 = r6 + r1;
|
|
const r54 = r7 - r0 - r8;
|
|
const r37 = circlePath2.call(this, r52, r52, r54, r4, arcSweepAngle);
|
|
const r31 = this.circlePath(r52, r52, r54, 0, r5);
|
|
const center = this.polarToCartesian(r52, r52, r54, r5);
|
|
const r71 = this.props.renderCap ? this.props.renderCap({
|
|
center
|
|
}) : null;
|
|
const width2 = size - 2 * r45;
|
|
const style2 = {
|
|
position: "absolute",
|
|
left: r45 + padding / 2,
|
|
top: r45 + padding / 2,
|
|
width: width2,
|
|
height: width2,
|
|
borderRadius: width2 / 2,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
overflow: "hidden",
|
|
...childrenContainerStyle
|
|
};
|
|
const strokeDasharray = dashedTint.gap > 0 ? Object.values(dashedTint).map((item) => parseInt(item)) : null;
|
|
const strokeDasharray2 = dashedBackground.gap > 0 ? Object.values(dashedBackground).map((item) => parseInt(item)) : null;
|
|
let r120 = backgroundColor;
|
|
if (r120) {
|
|
if (!backgroundWidth) {
|
|
backgroundWidth = width;
|
|
}
|
|
r120 = <Path d={r37} stroke={backgroundColor} strokeWidth={backgroundWidth} strokeLinecap={lineCap} strokeDasharray={strokeDasharray2} fill="transparent" />;
|
|
}
|
|
return <View style={style}>
|
|
<Svg width={size + padding} height={size + padding}>
|
|
<G rotation={rotation} originX={(size + padding) / 2} originY={(size + padding) / 2}>
|
|
{r120}
|
|
{fill > 0 && <Path d={r31} stroke={tintColor} strokeWidth={width} strokeLinecap={fillLineCap} strokeDasharray={strokeDasharray} fill="transparent" />}
|
|
{r71}
|
|
</G>
|
|
</Svg>
|
|
{children && <View style={style2}>
|
|
{children(fill)}
|
|
</View>}
|
|
</View>;
|
|
}
|
|
}]);
|
|
r45.propTypes = {
|
|
style: Module12253.object,
|
|
size: Module12253.oneOfType([Module12253.number, Module12253.instanceOf(Animated.Value)]).isRequired,
|
|
fill: Module12253.number.isRequired,
|
|
width: Module12253.number.isRequired,
|
|
backgroundWidth: Module12253.number,
|
|
tintColor: Module12253.string,
|
|
tintTransparency: Module12253.bool,
|
|
backgroundColor: Module12253.string,
|
|
rotation: Module12253.number,
|
|
lineCap: Module12253.string,
|
|
arcSweepAngle: Module12253.number,
|
|
children: Module12253.func,
|
|
childrenContainerStyle: Module12253.object,
|
|
padding: Module12253.number,
|
|
renderCap: Module12253.func,
|
|
dashedBackground: Module12253.object,
|
|
dashedTint: Module12253.object
|
|
};
|
|
r45.defaultProps = {
|
|
tintColor: "black",
|
|
tintTransparency: true,
|
|
rotation: 90,
|
|
lineCap: "butt",
|
|
arcSweepAngle: 360,
|
|
padding: 0,
|
|
dashedBackground: {
|
|
width: 0,
|
|
gap: 0
|
|
},
|
|
dashedTint: {
|
|
width: 0,
|
|
gap: 0
|
|
}
|
|
};
|
|
export default r45;
|