124 lines
3.7 KiB
TypeScript
124 lines
3.7 KiB
TypeScript
// Metro module 10291 (f10292).
|
|
import * as Module19 from "react";
|
|
import { PureComponent, Children } from "react";
|
|
import { View } from "react-native";
|
|
import { EMOJI_CHAT_SIZE } from "../../../Constants";
|
|
import { MUTED_OPACITY_CONTENT } from "../../channel_list_v2/native/RedesignChannelListConstants";
|
|
import { jsx } from "react/jsx-runtime";
|
|
import { createLegacyClassComponentStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { isAndroid } from "../../../utils/PlatformUtils";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { ThemeContext } from "../../../_bundle/Module3901";
|
|
import { LegacyText } from "../../../design/void/native";
|
|
function $mk84353($env) {
|
|
return (a0) => {
|
|
const r4 = $env.$parent;
|
|
const r2 = r4[2];
|
|
if (r2.isValidElement(a0)) {
|
|
const style = a0.props.style;
|
|
const r6 = Array.isArray(style) ? r4[4].flatten(style) : style;
|
|
let env26645;
|
|
const r17 = $env;
|
|
const children = a0.props.children;
|
|
const r19 = r17[0];
|
|
const r20 = env26645 = {
|
|
$parent: r4
|
|
};
|
|
env26645[0] = r19;
|
|
return r2.cloneElement(a0, {
|
|
children: r2.Children.map(children, $mk84353(r20)),
|
|
style: [r6, r19.spoiler],
|
|
onPress: void 0
|
|
});
|
|
}
|
|
return a0;
|
|
};
|
|
}
|
|
let c6873_7;
|
|
let env6873 = {};
|
|
const c6873_6 = createLegacyClassComponentStyles({
|
|
spoiler: {
|
|
color: isAndroid() ? "rgba(0,0,0,0.0019607844)" : "transparent",
|
|
backgroundColor: Module712.colors.SPOILER_HIDDEN_BACKGROUND
|
|
},
|
|
placeholder: {
|
|
width: EMOJI_CHAT_SIZE,
|
|
height: EMOJI_CHAT_SIZE,
|
|
backgroundColor: Module712.colors.SPOILER_HIDDEN_BACKGROUND
|
|
},
|
|
spoilerRevealed: {
|
|
color: Module712.colors.TEXT_DEFAULT,
|
|
backgroundColor: Module712.colors.SPOILER_REVEALED_BACKGROUND
|
|
},
|
|
muted: {
|
|
opacity: MUTED_OPACITY_CONTENT
|
|
}
|
|
});
|
|
class Spoiler extends PureComponent {
|
|
static contextType = ThemeContext;
|
|
state = {
|
|
revealed: false
|
|
};
|
|
handleTap = () => {
|
|
if (!(this.state.revealed || this.props.disableReveal)) {
|
|
this.setState({
|
|
revealed: !this.state.revealed
|
|
});
|
|
}
|
|
};
|
|
render() {
|
|
const r11 = c6873_6(this.context);
|
|
let c17844_0 = r11;
|
|
const revealed = this.state.revealed;
|
|
const props = this.props;
|
|
const { children, spoilerStyle, spoilerRevealedStyle } = props;
|
|
const r15 = revealed ? [r11.spoilerRevealed, spoilerRevealedStyle] : [r11.spoiler, spoilerStyle];
|
|
if (Children.count(children) === 0) {
|
|
return null;
|
|
}
|
|
return <LegacyText accessibilityRole="button" style={[r15, this.props.muted && r11.muted]} onPress={this.props.disableReveal ? void 0 : this.handleTap}>
|
|
{Children.map(children, (a0) => {
|
|
let r21;
|
|
const r5 = env6873;
|
|
const isValidElement = Module19.isValidElement(a0);
|
|
let r11 = a0;
|
|
if (isValidElement) {
|
|
L11: {
|
|
L7: {
|
|
if (a0.type.displayName !== "Image") {
|
|
if (a0.props?.source == null) {
|
|
break L7;
|
|
}
|
|
}
|
|
if (!revealed) {
|
|
r21 = (0, jsx)(View, {
|
|
style: c17844_0.placeholder
|
|
});
|
|
break L11;
|
|
}
|
|
}
|
|
const props = a0.props;
|
|
let r24 = a0;
|
|
if (props != null) {
|
|
r24 = a0;
|
|
if (!revealed) {
|
|
let env26646;
|
|
const r27 = env26646 = {
|
|
$parent: r5
|
|
};
|
|
env26646[0] = c17844_0;
|
|
r24 = Children.map(a0, $mk84353(r27));
|
|
}
|
|
}
|
|
r21 = r24;
|
|
}
|
|
r11 = r21;
|
|
}
|
|
return r11;
|
|
})}
|
|
</LegacyText>;
|
|
}
|
|
}
|
|
c6873_7 = Spoiler;
|
|
export default Spoiler;
|