decord/source/modules/chat_input/native/useChatInputMaxHeight.tsx

134 lines
7.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11205
// Function ID: 11206
2026-07-20 16:05:17 +00:00
// Name: getChatInputMaxHeight
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 19, 1496, 11188, 1895, 5449, 4243, 1627, 1494, 11206, 11207, 11208, 4671, 4674, 4119, 2]
2026-08-12 06:57:52 +00:00
// Exports: default, getChatInputHeightAnimationTiming, getChatInputHeightAnimationTimingWorklet, getChatInputMinHeight
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 11205 (getChatInputMaxHeight)
import useWindowDimensions from "useWindowDimensions" /* 1494 */;
import KeyboardTypes from "KeyboardTypes" /* 1627 */;
import useSystemKeyboardHeight from "useSystemKeyboardHeight" /* 1895 */;
import useKeyboardType from "useKeyboardType" /* 4243 */;
import useCustomKeyboardHeight from "useCustomKeyboardHeight" /* 5449 */;
import mutable from "mutable" /* 11206 */;
import mutable2 from "mutable" /* 11207 */;
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
import closure_5 from "subscribeToKeyboardUIStore" /* 1496 */;
import { CHAT_INPUT_PILL_CONTENT_SIZE } from "TextAreaCta" /* 11188 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function getChatInputMaxHeight() {
2026-08-24 06:08:38 +00:00
let systemKeyboardHeight = useSystemKeyboardHeight.getSystemKeyboardHeight();
const obj = useSystemKeyboardHeight;
2026-07-29 08:29:29 +00:00
const tmp = require;
2026-08-24 06:08:38 +00:00
const customKeyboardHeight = useCustomKeyboardHeight.getCustomKeyboardHeight();
const obj2 = useCustomKeyboardHeight;
const keyboardType = useKeyboardType.getKeyboardType();
if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) {
2026-07-20 16:05:17 +00:00
systemKeyboardHeight = customKeyboardHeight;
}
2026-08-24 06:08:38 +00:00
const obj3 = useKeyboardType;
return Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, useWindowDimensions.getWindowDimensions({ ignoreKeyboard: true }).height - systemKeyboardHeight - c6));
2026-07-20 16:05:17 +00:00
}
2026-08-12 06:57:52 +00:00
let c6 = 200;
function getChatInputMaxHeightWorklet() {
2026-08-24 06:08:38 +00:00
const keyboardStateWorklet = mutable.getKeyboardStateWorklet();
2026-08-12 06:57:52 +00:00
({ keyboardHeight, customKeyboardHeight, keyboardType } = keyboardStateWorklet);
2026-08-24 06:08:38 +00:00
if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) {
2026-08-12 06:57:52 +00:00
keyboardHeight = customKeyboardHeight;
}
2026-08-24 06:08:38 +00:00
const obj = mutable;
2026-08-12 06:57:52 +00:00
const tmp = require;
2026-08-24 06:08:38 +00:00
return Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, mutable2.getWindowDimensionsWorklet({ ignoreKeyboard: true }).height - keyboardHeight - c6));
2026-08-12 06:57:52 +00:00
}
let obj = { getKeyboardStateWorklet: require("mutable").getKeyboardStateWorklet, KeyboardTypes: require("KeyboardTypes").KeyboardTypes, getWindowDimensionsWorklet: require("mutable").getWindowDimensionsWorklet, MAX_HEIGHT: 200, MIN_HEIGHT: CHAT_INPUT_PILL_CONTENT_SIZE };
getChatInputMaxHeightWorklet.__closure = obj;
getChatInputMaxHeightWorklet.__workletHash = 13025947543230;
getChatInputMaxHeightWorklet.__initData = { code: "function getChatInputMaxHeightWorklet_useChatInputMaxHeightTsx1(){const{getKeyboardStateWorklet,KeyboardTypes,getWindowDimensionsWorklet,MAX_HEIGHT,MIN_HEIGHT}=this.__closure;const{keyboardHeight:keyboardHeightSystem,customKeyboardHeight:customKeyboardHeight,keyboardType:keyboardType}=getKeyboardStateWorklet();const keyboardHeight=keyboardType!==KeyboardTypes.SYSTEM?customKeyboardHeight:keyboardHeightSystem;const window=getWindowDimensionsWorklet({ignoreKeyboard:true});const windowHeightNoKeyboard=window.height-keyboardHeight;return Math.min(MAX_HEIGHT,Math.max(MIN_HEIGHT*2,windowHeightNoKeyboard-MAX_HEIGHT));}" };
2026-08-14 17:33:39 +00:00
function getChatInputHeightAnimationTimingWorklet(height, textFieldMinHeight) {
const bound = Math.max(height, textFieldMinHeight);
2026-08-12 06:57:52 +00:00
if (typeof getChatInputMaxHeightWorklet !== "function") {
HermesBuiltin.throwTypeError();
}
2026-08-24 06:08:38 +00:00
let obj = mutable;
2026-08-12 06:57:52 +00:00
const keyboardStateWorklet = obj.getKeyboardStateWorklet();
({ keyboardHeight, customKeyboardHeight, keyboardType } = keyboardStateWorklet);
2026-08-24 06:08:38 +00:00
if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) {
2026-08-12 06:57:52 +00:00
keyboardHeight = customKeyboardHeight;
}
2026-08-24 06:08:38 +00:00
let tmp2Result = tmp2(11207);
2026-08-14 17:33:39 +00:00
const bound1 = Math.min(bound, Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, tmp2Result.getWindowDimensionsWorklet({ ignoreKeyboard: true }).height - keyboardHeight - c6)));
2026-08-24 06:08:38 +00:00
tmp2Result = tmp2(4671);
obj = { duration: tmp2(4674).timingFastDuration, easing: tmp2(4119).Easing.linear };
2026-08-14 17:33:39 +00:00
return tmp2Result.withTiming(bound1, obj);
2026-08-12 06:57:52 +00:00
}
2026-08-24 06:08:38 +00:00
obj = { getChatInputMaxHeightWorklet, withTiming: require("CONFIG_NEVER_ANIMATE_TIMING").withTiming, timingFastDuration: require("timingNone").timingFastDuration, Easing: require("module_4119").Easing };
2026-08-12 06:57:52 +00:00
getChatInputHeightAnimationTimingWorklet.__closure = obj;
2026-08-14 17:33:39 +00:00
getChatInputHeightAnimationTimingWorklet.__workletHash = 17042993287975;
getChatInputHeightAnimationTimingWorklet.__initData = { code: "function getChatInputHeightAnimationTimingWorklet_useChatInputMaxHeightTsx2(contentSize,minHeight){const{getChatInputMaxHeightWorklet,withTiming,timingFastDuration,Easing}=this.__closure;const value=Math.min(Math.max(contentSize,minHeight),getChatInputMaxHeightWorklet());return withTiming(value,{duration:timingFastDuration,easing:Easing.linear});}" };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/chat_input/native/useChatInputMaxHeight.tsx");
2026-07-20 16:05:17 +00:00
export default function useChatInputMaxHeight(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-23 10:11:24 +00:00
let tmp = callback(React.useState(getChatInputMaxHeight), 2);
2026-08-24 06:08:38 +00:00
closure_1 = tmp[1];
2026-07-20 16:05:17 +00:00
const items = [arg0];
const effect = React.useEffect(() => {
function maybeUpdateMaxHeight() {
callback2((arg0) => {
2026-08-24 06:08:38 +00:00
let systemKeyboardHeight = closure_1_0(closure_1_2[4]).getSystemKeyboardHeight();
const obj = closure_1_0(closure_1_2[4]);
const tmp = closure_1_0;
const tmp2 = closure_1_2;
const customKeyboardHeight = closure_1_0(closure_1_2[5]).getCustomKeyboardHeight();
const obj2 = closure_1_0(closure_1_2[5]);
const keyboardType = closure_1_0(closure_1_2[6]).getKeyboardType();
if (keyboardType !== closure_1_0(closure_1_2[7]).KeyboardTypes.SYSTEM) {
2026-07-29 08:29:29 +00:00
systemKeyboardHeight = customKeyboardHeight;
}
let tmp6 = arg0;
2026-08-24 06:08:38 +00:00
const obj3 = closure_1_0(closure_1_2[6]);
const bound = Math.min(closure_1_6, Math.max(2 * closure_1_7, tmp(tmp2[8]).getWindowDimensions({ ignoreKeyboard: true }).height - systemKeyboardHeight - closure_1_6));
2026-07-29 08:29:29 +00:00
if (arg0 !== bound) {
tmp6 = bound;
if (callback != null) {
2026-07-20 16:05:17 +00:00
callback();
2026-07-29 08:29:29 +00:00
tmp6 = bound;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return tmp6;
2026-07-20 16:05:17 +00:00
});
}
2026-08-24 06:08:38 +00:00
closure_0 = callback(closure_1_2[11])(maybeUpdateMaxHeight);
callback = closure_1_5(maybeUpdateMaxHeight);
2026-07-20 16:05:17 +00:00
return () => {
callback();
callback2();
};
}, items);
return tmp[0];
};
export function getChatInputMinHeight() {
2026-08-12 06:57:52 +00:00
return CHAT_INPUT_PILL_CONTENT_SIZE;
2026-07-20 16:05:17 +00:00
}
export { getChatInputMaxHeight };
2026-08-12 06:57:52 +00:00
export { getChatInputMaxHeightWorklet };
2026-08-14 17:33:39 +00:00
export const getChatInputHeightAnimationTiming = function getChatInputHeightAnimationTiming(height, closure_8) {
const bound = Math.max(height, closure_8);
2026-08-24 06:08:38 +00:00
let obj = useSystemKeyboardHeight;
2026-07-29 08:29:29 +00:00
let systemKeyboardHeight = obj.getSystemKeyboardHeight();
2026-08-24 06:08:38 +00:00
const customKeyboardHeight = useCustomKeyboardHeight.getCustomKeyboardHeight();
const obj2 = useCustomKeyboardHeight;
const keyboardType = useKeyboardType.getKeyboardType();
if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) {
2026-07-29 08:29:29 +00:00
systemKeyboardHeight = customKeyboardHeight;
}
2026-08-15 05:55:55 +00:00
let tmp2Result = tmp2(1494);
2026-08-14 17:33:39 +00:00
const bound1 = Math.min(bound, Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, tmp2Result.getWindowDimensions({ ignoreKeyboard: true }).height - systemKeyboardHeight - c6)));
2026-08-24 06:08:38 +00:00
tmp2Result = tmp2(4671);
obj = { duration: tmp2(4674).timingFastDuration, easing: tmp2(4119).Easing.linear };
2026-08-14 17:33:39 +00:00
return tmp2Result.withTiming(bound1, obj);
2026-07-20 16:05:17 +00:00
};
2026-08-12 06:57:52 +00:00
export { getChatInputHeightAnimationTimingWorklet };