Files
discord-decomp/components_native/common/SequencedLottieAnimationView.tsx
T
2026-11-01 12:12:55 +02:00

52 lines
1.7 KiB
TypeScript

// Metro module 12685 (f12686).
import { PureComponent } from "react";
import { View } from "react-native";
import Module5507 from "../../_bundle/Module5507";
const _excluded = ["source", "style"];
class SequencedLottieAnimationView extends PureComponent {
static defaultProps = {
autoPlay: true
};
animationRef = null;
currentScene = this.props.nextScene;
isUnmounted = false;
handleComplete = () => {
const onSceneComplete = this.props.onSceneComplete;
if (onSceneComplete != null) {
onSceneComplete(this.currentScene);
}
};
handleSetRef = (a0) => {
this.animationRef = a0;
};
componentDidMount() {
this.playScene(this.props.nextScene);
}
componentDidUpdate() {
const nextScene = this.props.nextScene;
if (nextScene !== this.currentScene) {
this.playScene(nextScene);
}
}
playScene(a0) {
const sceneSegments = this.props.sceneSegments;
const r9 = sceneSegments[a0];
const r10 = sceneSegments[this.currentScene];
if (!(this.animationRef == null || a0 !== this.currentScene && r9.BEG === r10.BEG && r9.END === r10.END)) {
this.animationRef.play(r9.BEG, r9.END);
}
this.currentScene = a0;
}
render() {
const props = this.props;
const { source, style, ...rest } = props;
const r10 = (typeof source === "object" ? source.uri ? void 0 : JSON.stringify(source) : void 0) !== void 0 ? {
aspectRatio: source.w / source.h
} : void 0;
return <View style={[r10, style]}>
<Module5507 source={source} style={[r10, style]} {...rest} ref={this.handleSetRef} onAnimationFinish={this.handleComplete} />
</View>;
}
}
export default SequencedLottieAnimationView;