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

151 lines
5.1 KiB
React

// Metro module 5508 (f5509).
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 { processColor, View } from "react-native";
import { jsx } from "react/jsx-runtime";
import Module5509, { Commands } from "./Module5509";
import { parsePossibleSources } from "./Module5510";
let _excluded;
let LottieView;
let env3381 = {};
env3381[11] = function _isNativeReflectConstruct() {
let c14887_0;
try {
c14887_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
} catch ($e) {}
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
return !!c14887_0;
};
env3381[11] = _isNativeReflectConstruct2;
return _isNativeReflectConstruct2();
};
_excluded = ["style", "source", "autoPlay", "duration", "textFiltersAndroid", "textFiltersIOS", "resizeMode", "containerStyle"];
const defaultProps = {
source: void 0,
progress: 0,
speed: 1,
loop: true,
autoPlay: false,
enableMergePathsAndroidForKitKatAndAbove: false,
enableSafeModeAndroid: false,
cacheComposition: true,
useNativeLooping: false,
resizeMode: "contain",
colorFilters: [],
textFiltersAndroid: [],
textFiltersIOS: []
};
const PureComponent = Module19.PureComponent;
LottieView = function LottieView(a0) {
_classCallCheck(this, LottieView);
const r9 = [a0];
const r8 = _getPrototypeOf(LottieView);
const r22 = _possibleConstructorReturn(this, (0, env3381[11])() ? Reflect.construct(r8, r9, _getPrototypeOf(this).constructor) : r8.apply(this, r9));
r22.onAnimationFinish = (a0) => {
const props = this.props;
const onAnimationFinish = props.onAnimationFinish;
if (onAnimationFinish != null) {
onAnimationFinish.call(props, a0.nativeEvent.isCancelled);
}
};
r22.onAnimationFailure = (a0) => {
const props = this.props;
const onAnimationFailure = props.onAnimationFailure;
if (onAnimationFailure != null) {
onAnimationFailure.call(props, a0.nativeEvent.error);
}
};
r22.onAnimationLoaded = () => {
const props = this.props;
const onAnimationLoaded = props.onAnimationLoaded;
if (onAnimationLoaded != null) {
onAnimationLoaded.call(props);
}
};
r22.play = r22.play.bind(r22);
r22.reset = r22.reset.bind(r22);
r22.pause = r22.pause.bind(r22);
r22.resume = r22.resume.bind(r22);
r22.onAnimationFinish = r22.onAnimationFinish.bind(r22);
r22.captureRef = r22.captureRef.bind(r22);
a0.hover;
return r22;
};
_inherits(LottieView, PureComponent);
const r58 = _createClass(LottieView, [{
key: "play",
value: function play(a0, a1) {
let r7 = a0;
const lottieAnimationViewRef = this.lottieAnimationViewRef;
if (a0 == null) {
r7 = -1;
}
Commands.play(lottieAnimationViewRef, r7, a1 == null ? -1 : a1);
}
}, {
key: "reset",
value: function reset() {
Commands.reset(this.lottieAnimationViewRef);
}
}, {
key: "pause",
value: function pause() {
Commands.pause(this.lottieAnimationViewRef);
}
}, {
key: "resume",
value: function resume() {
Commands.resume(this.lottieAnimationViewRef);
}
}, {
key: "captureRef",
value: function captureRef(a0) {
if (a0 !== null) {
this.lottieAnimationViewRef = a0;
if (this.props.autoPlay === true) {
this.play();
}
}
}
}, {
key: "renderLottieView",
value: function renderLottieView() {
const props = this.props;
const { style, source, autoPlay, duration, textFiltersAndroid, textFiltersIOS, resizeMode } = props;
props.containerStyle;
const rest = _objectWithoutProperties(props, _excluded);
const props2 = parsePossibleSources(source);
const speed = duration && (props2.sourceJson && source.fr) ? Math.round(source.op / source.fr * 1000 / duration) : this.props.speed;
const colorFilters = this.props.colorFilters;
return <Module5509 ref={this.captureRef} {...rest} colorFilters={colorFilters == null ? void 0 : colorFilters.map((colorFilter) => ({
...colorFilter,
color: (0, processColor)(colorFilter.color)
}))} textFiltersAndroid={textFiltersAndroid} textFiltersIOS={textFiltersIOS} speed={speed} style={style} onAnimationFinish={this.onAnimationFinish} onAnimationFailure={this.onAnimationFailure} onAnimationLoaded={this.onAnimationLoaded} autoPlay={autoPlay} resizeMode={resizeMode} {...props2} />;
}
}, {
key: "render",
value: function render() {
let r10;
const props = this.props;
const { source, containerStyle } = props;
if (source == null) {
console.warn("LottieView needs `source` parameter, provided value for source:", source);
r10 = null;
} else {
r10 = containerStyle ? (0, jsx)(View, {
style: containerStyle,
collapsable: false,
children: this.renderLottieView()
}) : this.renderLottieView();
}
return r10;
}
}]);
r58.defaultProps = defaultProps;
export { r58 as LottieView };