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

36 lines
1.8 KiB
TypeScript

// Metro module 15588 (f15589).
import * as Module19 from "react";
import { useMemo } from "react";
import ChannelStore from "../../../stores/ChannelStore";
import { FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID, FAKE_PLACEHOLDER_PRIVATE_CHANNEL } from "../../channel/FakePlaceholderPrivateChannel";
import { KeyboardTypes } from "./KeyboardTypes";
import AppLauncherKeyboard from "../../app_launcher/native/AppLauncherKeyboard";
import { AppLauncherEntrypoint } from "../../app_launcher/AppLauncherTypes";
import MediaKeyboard from "../../media_keyboard/native/components/MediaKeyboard";
import ExpressionPickerKeyboard from "../../expression_picker/native/ExpressionPickerKeyboard";
const r22 = Module19.memo(function PortalKeyboardRendererComponent(props) {
const item = props.item;
const { channelId, chatInputRef, type } = item;
const { state, cleanUp } = props;
const channel = ChannelStore.getChannel(channelId);
const memo = useMemo(() => channelId !== FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID ? channel : FAKE_PLACEHOLDER_PRIVATE_CHANNEL, [channel, channelId]);
const memo2 = useMemo(() => memo != null ? {
channel: memo,
type: "channel"
} : void 0, [memo]);
if (memo != null && memo2 !== void 0) {
if (KeyboardTypes.APP_LAUNCHER === type) {
return <AppLauncherKeyboard context={memo2} chatInputRef={chatInputRef} onClose={cleanUp} transitionState={state} entrypoint={AppLauncherEntrypoint.TEXT} />;
}
if (KeyboardTypes.MEDIA === type) {
return <MediaKeyboard channel={memo} chatInputRef={chatInputRef} onClose={cleanUp} transitionState={state} />;
}
if (KeyboardTypes.EXPRESSION === type) {
return <ExpressionPickerKeyboard channel={memo} chatInputRef={chatInputRef} onClose={cleanUp} transitionState={state} />;
}
return null;
}
return null;
});
export default r22;