This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,59 @@
// Metro module 11386 (f11387).
import { useState, useMemo } from "react";
import { ActivityIndicator } from "react-native";
import { DraftType } from "../../../stores/DraftStore";
import UploadAttachmentStore from "../../../stores/UploadAttachmentStore";
import { EMOJI_URL_BASE_SIZE } from "../../emojis/EmojiConstants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { PollMediaUploadAttachmentStatus } from "../PollTypes";
import FastImage from "../../../components_native/common/FastImage";
import Emoji from "../../emojis/native/Emoji";
import { EmojiTypes } from "../../emojis/EmojiTypes";
import AvatarUtils from "../../../utils/AvatarUtils";
export default function useRenderPollAnswerImage(c18797_0, c18797_1, a2, a3, a4) {
let c18797_7;
const width = a4;
const stateFromStores = useStateFromStores([UploadAttachmentStore], () => UploadAttachmentStore.getUpload(c18797_0, c18797_1, DraftType.Poll));
const [state, setUploadSize] = useState();
const r34 = (a2 == null ? void 0 : a2.mediaAttachmentState?.status) === PollMediaUploadAttachmentStatus.PREPARING;
c18797_7 = r34;
return {
renderImage: useMemo(() => {
if (c18797_7) {
return <ActivityIndicator />;
}
if (stateFromStores != null) {
const item = stateFromStores.item;
let width2 = a3;
if (width2 == null) {
width2 = state;
}
return <FastImage style={{
width: width2,
height: width2
}} source={{
uri: item.uri
}} />;
}
if (a2?.emoji != null) {
const emoji = a2.emoji;
let name = emoji.type === EmojiTypes.UNICODE ? emoji.surrogates : emoji.name;
if (name == null) {
name = "";
}
return <Emoji fastImageStyle={{
width,
height: width
}} textEmojiStyle={{
fontSize: width
}} name={name} src={emoji.id != null ? AvatarUtils.getEmojiURL({
id: emoji.id,
animated: emoji.animated,
size: EMOJI_URL_BASE_SIZE
}) : void 0} />;
}
}, [a2, a4, a3, stateFromStores, r34, state]),
upload: stateFromStores,
setUploadSize
};
};