Files
discord-decomp/_bundle/AnimatedCircularProgress.jsx
T
2026-11-01 12:12:55 +02:00

111 lines
3.6 KiB
React

// Metro module 14086 (f14087).
import _objectWithoutProperties from "./_objectWithoutProperties";
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 * as _Module17 from "react-native";
import CircularProgress from "./CircularProgress";
import Module12253 from "./Module12253";
let _excluded, Component;
let AnimatedCircularProgress;
let env9852 = {};
env9852[7] = function _isNativeReflectConstruct() {
let c20891_0;
try {
c20891_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
} catch ($e) {}
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
return !!c20891_0;
};
env9852[7] = _isNativeReflectConstruct2;
return _isNativeReflectConstruct2();
};
_excluded = ["fill", "prefill"];
const { Animated: Animated2, Easing } = _Module17;
Component = Animated2.createAnimatedComponent(CircularProgress);
const PureComponent = Module19.PureComponent;
AnimatedCircularProgress = function AnimatedCircularProgress(a0) {
let c27622_0 = a0;
_classCallCheck(this, AnimatedCircularProgress);
const r11 = [a0];
const r10 = _getPrototypeOf(AnimatedCircularProgress);
const r26 = _possibleConstructorReturn(this, (0, env9852[7])() ? Reflect.construct(r10, r11, _getPrototypeOf(this).constructor) : r10.apply(this, r11));
r26.state = {
fillAnimation: new _Module17.Animated.Value(a0.prefill)
};
if (a0.onFillChange) {
r26.state.fillAnimation.addListener((a0) => c27622_0.onFillChange(a0.value));
}
return r26;
};
_inherits(AnimatedCircularProgress, PureComponent);
const r59 = _createClass(AnimatedCircularProgress, [{
key: "componentDidMount",
value: function componentDidMount() {
this.animate();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(a0) {
if (a0.fill !== this.props.fill) {
this.animate();
}
}
}, {
key: "reAnimate",
value: function reAnimate(a0, c27623_1, c27623_2, c27623_0) {
this.setState({
fillAnimation: new _Module17.Animated.Value(a0)
}, () => this.animate(c27623_1, c27623_2, c27623_0));
}
}, {
key: "animate",
value: function animate(a0, a1, a2) {
const r18 = _Module17.Animated.timing(this.state.fillAnimation, {
useNativeDriver: this.props.useNativeDriver,
toValue: a0 >= 0 ? a0 : this.props.fill,
easing: a2 ? a2 : this.props.easing,
duration: a1 ? a1 : this.props.duration,
delay: this.props.delay
});
r18.start(this.props.onAnimationComplete);
return r18;
}
}, {
key: "animateColor",
value: function animateColor() {
return this.props.tintColorSecondary ? this.state.fillAnimation.interpolate({
inputRange: [0, 100],
outputRange: [this.props.tintColor, this.props.tintColorSecondary]
}) : this.props.tintColor;
}
}, {
key: "render",
value: function render() {
const props = this.props;
props.fill;
props.prefill;
return <Component {..._objectWithoutProperties(props, _excluded)} fill={this.state.fillAnimation} tintColor={this.animateColor()} />;
}
}]);
r59.propTypes = {
...CircularProgress.propTypes,
prefill: Module12253.number,
duration: Module12253.number,
easing: Module12253.func,
onAnimationComplete: Module12253.func,
useNativeDriver: Module12253.bool,
delay: Module12253.number
};
r59.defaultProps = {
duration: 500,
easing: Easing.out(Easing.ease),
prefill: 0,
useNativeDriver: false,
delay: 0
};
export default r59;