Files
discord-decomp/modules/media_channel/native/MediaPostGridThumbnail.tsx
T
2026-11-01 12:12:55 +02:00

44 lines
2.3 KiB
TypeScript

// Metro module 11188 (f11189).
import { ImageBackground, StyleSheet } from "react-native";
import { Fragment } from "react/jsx-runtime";
import { ForumPostMediaSpoiler } from "../../forums/native/posts/ForumPostMedia";
import FastImage from "../../../components_native/common/FastImage";
import { isAndroid } from "../../../utils/PlatformUtils";
let MediaPostGridThumbnailIOS;
const MediaPostGridThumbnailAndroid = function MediaPostGridThumbnailAndroid(props) {
const { shouldSpoiler, blurTheme, source, androidStyle, backgroundImagesource, resizeMode } = props;
return backgroundImagesource == null ? <ImageBackground style={androidStyle} source={source} blurRadius={shouldSpoiler ? 10 : 0} resizeMode="cover">
<ForumPostMediaSpoiler shouldSpoiler={shouldSpoiler} blurTheme={blurTheme} />
</ImageBackground> : <ImageBackground style={androidStyle} source={backgroundImagesource} resizeMode="cover" imageStyle={{
opacity: 0.2
}}>
<FastImage style={StyleSheet.absoluteFill} source={source} resizeMode={resizeMode} />
<ForumPostMediaSpoiler shouldSpoiler={shouldSpoiler} blurTheme={blurTheme} />
</ImageBackground>;
};
MediaPostGridThumbnailIOS = function MediaPostGridThumbnailIOS(props) {
const { shouldSpoiler, blurTheme, source, iosStyle, backgroundImagesource, resizeMode } = props;
return <Fragment {...backgroundImagesource == null ? {
children: [<FastImage style={iosStyle} source={source} resizeMode={resizeMode} />, <ForumPostMediaSpoiler shouldSpoiler={shouldSpoiler} blurTheme={blurTheme} />]
} : {
children: [<FastImage style={[StyleSheet.absoluteFill, {
opacity: 0.2
}]} source={backgroundImagesource} resizeMode="cover" />, <FastImage style={iosStyle} source={source} resizeMode={resizeMode} />, <ForumPostMediaSpoiler shouldSpoiler={shouldSpoiler} blurTheme={blurTheme} />]
}} />;
};
export default function MediaPostGridThumbnail(props) {
const r0 = props.isPortrait === true && props.shouldSpoiler === false;
let resizeMode = "cover";
let backgroundImagesource = void 0;
if (r0) {
backgroundImagesource = props.source;
resizeMode = "contain";
}
const props2 = {
...props,
backgroundImagesource,
resizeMode
};
return isAndroid() ? <MediaPostGridThumbnailAndroid {...props2} /> : <MediaPostGridThumbnailIOS {...props2} />;
};