decord/source/modules/share/native/useShareChatInputActions.tsx

87 lines
2.8 KiB
TypeScript
Raw Normal View History

// Module ID: 11834
// Function ID: 11835
2026-07-20 16:05:17 +00:00
// Name: useShareChatInputActions
// Dependencies: [32, 19, 1375, 11274, 2]
2026-07-20 16:05:17 +00:00
// Exports: useShareChatInputActions
// Module 11834 (useShareChatInputActions)
import openEmojiPickerActionSheet from "openEmojiPickerActionSheet" /* 11274 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
require = fn;
const EmojiIntention = fn(1375).EmojiIntention;
const size = fn(2);
let result = size.fileFinishedImporting("modules/share/native/useShareChatInputActions.tsx");
2026-07-20 16:05:17 +00:00
export const useShareChatInputActions = function useShareChatInputActions(setText, selectedDestinationChannel, appEntryKey) {
const channel = selectedDestinationChannel;
_slicedToArray = appEntryKey;
2026-07-23 10:11:24 +00:00
ref = ref.useRef(null);
2026-08-24 06:08:38 +00:00
closure_4 = ref.useRef({ start: 0, end: 0 });
[tmp3, closure_5] = ref.useState(false);
const callback = ref.useCallback((nativeEvent) => {
2026-07-20 16:05:17 +00:00
const merged = Object.assign(nativeEvent.nativeEvent.selection);
closure_4.current = {};
}, []);
2026-07-23 10:11:24 +00:00
const callback1 = ref.useCallback(() => {
closure_1_5(true);
2026-07-20 16:05:17 +00:00
}, []);
const items = [setText];
2026-07-23 10:11:24 +00:00
const callback2 = ref.useCallback(() => {
closure_1_5(false);
2026-07-20 16:05:17 +00:00
}, []);
2026-07-23 10:11:24 +00:00
const callback3 = ref.useCallback((id) => {
2026-08-24 06:08:38 +00:00
setText = "";
2026-07-20 16:05:17 +00:00
if (null == id.id) {
if (null != id.surrogates) {
setText = id.surrogates;
}
setText((arr) => {
const sum = arr.slice(0, ref.current.start) + closure_0;
return sum + arr.slice(ref.current.end);
2026-07-20 16:05:17 +00:00
});
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.focus();
}
}
if (null != id.uniqueName) {
if ("" !== id.uniqueName) {
let name = id.uniqueName;
}
const _HermesInternal = HermesInternal;
setText = ":" + name + ": ";
}
name = id.name;
}, items);
2026-07-23 10:11:24 +00:00
const callback4 = ref.useCallback(() => {
2026-07-20 16:05:17 +00:00
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.focus();
}
}, []);
const items1 = [callback4, callback3, selectedDestinationChannel, appEntryKey];
const tmp2 = _slicedToArray(ref.useState(false), 2);
2026-07-20 16:05:17 +00:00
return {
textInputRef: ref,
isInputFocused: tmp3,
handleSelectionChange: callback,
handleMessageFocus: callback1,
handleMessageBlur: callback2,
2026-07-23 10:11:24 +00:00
handlePressEmoji: ref.useCallback(() => {
2026-07-20 16:05:17 +00:00
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.blur();
}
const obj2 = { onPressEmoji: callback3, onClose: callback4, pickerIntention: EmojiIntention.CHAT, autoFocus: false, startExpanded: false, channel, appEntryKey, guildId: null };
2026-07-20 16:05:17 +00:00
let guildId;
if (channel != null) {
guildId = channel.getGuildId();
2026-07-20 16:05:17 +00:00
}
obj2.guildId = guildId;
const result = openEmojiPickerActionSheet.openEmojiPickerActionSheet(obj2);
2026-07-20 16:05:17 +00:00
}, items1)
};
};