Files
discord-decomp/design/components/Icon/native/ClipView.tsx
T
2026-11-01 12:12:55 +02:00

75 lines
2.3 KiB
TypeScript

// Metro module 7970 (f7971).
import { View, StyleSheet } from "react-native";
import { useCutoutBackgroundColor } from "./CutoutBackgroundContext";
import Module7973 from "../../../../_bundle/Module7973";
import ReanimatedRexport from "../../../../modules/reanimated/ReanimatedRexport";
let c5036_6, cutouts, SolidCutoutOverlay, styles;
const SolidCutout = function SolidCutout(props) {
const { backgroundColor: backgroundColor2, cutout } = props;
const style = [styles.solidCutout];
if (cutout.shape === c5036_6.Circle) {
style.push({
backgroundColor: backgroundColor2,
borderRadius: cutout.size / 2,
height: cutout.size,
width: cutout.size,
left: cutout.x,
top: cutout.y
});
} else {
style.push({
backgroundColor: backgroundColor2,
borderRadius: cutout.cornerRadius,
height: cutout.height,
width: cutout.width,
left: cutout.x,
top: cutout.y
});
if (cutout.rotationDegrees != null) {
style.push({
transform: [{
rotate: `${cutout.rotationDegrees}deg`
}]
});
}
}
return <View style={style} />;
};
SolidCutoutOverlay = function SolidCutoutOverlay(props) {
const backgroundColor = props.backgroundColor;
return <View pointerEvents="none" style={styles.solidCutoutContainer}>
{props.cutouts.map((a0, index) => <SolidCutout key={index} backgroundColor={backgroundColor} cutout={a0} />)}
</View>;
};
c5036_6 = {
Circle: "circle",
RoundedRect: "rounded-rect"
};
cutouts = [];
styles = StyleSheet.create({
solidCutoutContainer: {
...StyleSheet.absoluteFillObject
},
solidCutout: {
position: "absolute"
}
});
const AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Module7973);
export default function ClipView(props) {
const { children, cutouts: cutouts2, style, ...props2 } = props;
const cutoutBackgroundColor = useCutoutBackgroundColor();
const r1 = cutoutBackgroundColor != null;
let r24 = null;
let cutouts3 = cutouts2;
if (r1) {
r24 = cutouts2 != null && cutouts2.length > 0 ? <SolidCutoutOverlay backgroundColor={cutoutBackgroundColor} cutouts={cutouts2} /> : null;
cutouts3 = cutouts;
}
return <Module7973 {...props2} cutouts={cutouts3} style={style}>
{children}
{r24}
</Module7973>;
};
export { AnimatedComponent as ClipViewAnimated };
export { c5036_6 as CutoutShape };