Files
discord-decomp/sources/design/components/Input/native/useInputAttachments.native.tsx
T
2026-07-28 01:06:53 +03:00

147 lines
8.7 KiB
TypeScript

/* Metro module 6991; source: design/components/Input/native/useInputAttachments.native.tsx; dependencies: [57, 31, 27, 33, 6817, 4573, 1357, 6992, 2] */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import MobileVisualRefreshExperiment from '../../../../modules/themes/experiments/MobileVisualRefreshExperiment.tsx'; /* Metro dependency 1357 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as InputFieldContainerNativeModule from './InputFieldContainer.native.tsx'; /* Metro dependency 6992 */
function _fun55400(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55400, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:6, offset: 0x013a59e7, size: 242 bytes, params: 8, frame: 22
const env0_0 = require;
const estimateAttachmentWidth2 = estimateAttachmentWidth;
const renderInputAttachment2 = renderInputAttachment;
const InputAttachmentContainer2 = InputAttachmentContainer;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
ReactNativeModule.Platform;
(FileImportTrackerModule).fileFinishedImporting('design/components/Input/native/useInputAttachments.native.tsx');
exports.estimateAttachmentWidth = estimateAttachmentWidth2;
exports.renderInputAttachment = renderInputAttachment2;
exports.InputAttachmentContainer = InputAttachmentContainer2;
exports.useInputAttachments = useInputAttachments;
function estimateAttachmentWidth(a0, a1) { // fn#55401, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:176, offset: 0x013a5ad9, size: 60 bytes, params: 3, frame: 12
return a0 != null ? (require(6817) /* metro dependency 6817: IconSize */).ICON_SIZE.xs + a1 : 0;
}
function renderInputAttachment(a0, a1, a2) { // fn#55402, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:254, offset: 0x013a5b15, size: 117 bytes, params: 4, frame: 17
const value = null;
if (value != a0) {
return ((Component) => <Component size="xs" color="input-icon-default" />)(a0);
} else if (value != a1) {
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
<Text variant="text-md/normal" style={a2}>
{a1}
</Text>
);
} else {
return value;
}
}
function InputAttachmentContainer({content, style, setWidth, pressableProps}) { // fn#55403, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:426, offset: 0x013a5b8a, size: 176 bytes, params: 2, frame: 18
const value = null;
return (
value == content
? value
: (
value != pressableProps
? (
<Pressable
role="button"
{...pressableProps}
{...{['style']: style}}
{...{['onLayout']: function(a0) {
return setWidth(a0.nativeEvent.layout.width);
}}}
>
{content}
</Pressable>
)
: (
<View style={style} onLayout={onLayout_55406}>
{content}
</View>
)
)
);
function style({pressed}) { // fn#55404, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:579, owner: InputAttachmentContainer.style, offset: 0x013a5c3a, size: 69 bytes, params: 2, frame: 4
return [style, {pointerEvents: 'auto'}, pressed ? {opacity: 0.2} : undefined];
}
function InputAttachmentContainerOnLayout_55406({nativeEvent}) { // fn#55406, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:720, owner: InputAttachmentContainer.onLayout, offset: 0x013a5c7f, size: 36 bytes, params: 2, frame: 11
return setWidth(nativeEvent.layout.width);
}
}
function useInputAttachments(a0, a1) { // fn#55407, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:1031, offset: 0x013a5ca3, size: 551 bytes, params: 3, frame: 30
const value2 = undefined;
const value3 = (MobileVisualRefreshExperiment)('useInputAttachments');
const useInputStyles = InputFieldContainerNativeModule.useInputStyles;
let leadingIcon = a0.leadingIcon;
const value4 = Reflect.apply(useInputStyles, InputFieldContainerNativeModule, [{size: a0.size,
hasLeadingIcon: leadingIcon != null, isRefreshEnabled: value3}]);
leadingIcon = a0.leadingIcon;
const leadingText = a0.leadingText;
const leadingPressableProps2 = a0.leadingPressableProps;
const trailingIcon = a0.trailingIcon;
const trailingText = a0.trailingText;
const trailingPressableProps2 = a0.trailingPressableProps;
const r19 = (a1 == null ? value2 : a1.leading) ?? renderInputAttachment(leadingIcon, leadingText, value4.text);
const r14 = (a1 == null ? value2 : a1.trailing) ?? renderInputAttachment(trailingIcon, trailingText, value4.text);
const r16 = leadingIcon != null ? value4.leadingIcon : (a1 == null ? value2 : a1.leading) == null ? value4.leadingText : value4.leadingIcon;
const r9 = trailingIcon != null ? value4.trailingIcon : (a1 == null ? value2 : a1.trailing) == null ? value4.trailingText : value4.trailingIcon;
let useState = ReactModule.useState;
const value7 = Reflect.apply(useState, ReactModule, [_fun55408]);
const value8 = Module00057(value7, 2);
const property = value8[0];
const property2 = value8[1];
useState = ReactModule.useState;
const value9 = Module00057(Reflect.apply(useState, ReactModule, [_fun55409]), 2);
const property3 = value9[0];
const property4 = value9[1];
object = {};
object.leading = (
<InputAttachmentContainer
content={r19}
setWidth={property2}
pressableProps={(a1 == null ? value2 : a1.leadingPressableProps) ?? leadingPressableProps2}
style={r16}
/>
);
object.trailing = (
<InputAttachmentContainer
content={r14}
setWidth={property4}
pressableProps={(a1 == null ? value2 : a1.trailingPressableProps) ?? trailingPressableProps2}
style={r9}
/>
);
object.inputStyle = {marginStart: property === 0 ? value2 : property - value4.padding.paddingHorizontal,
marginEnd: property3 === 0 ? value2 : property3 - value4.padding.paddingHorizontal};
return object;
function _fun55408() { // fn#55408, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:1631, offset: 0x013a5eca, size: 56 bytes, params: 1, frame: 13
const estimateAttachmentWidthBinding = estimateAttachmentWidth;
const leadingIconBinding = leadingIcon;
const binding = env0_0;
return estimateAttachmentWidthBinding(leadingIconBinding,
binding.leadingIcon.paddingStart + binding.leadingIcon.paddingEnd);
}
function _fun55409() { // fn#55409, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7169:1753, offset: 0x013a5f02, size: 56 bytes, params: 1, frame: 13
const estimateAttachmentWidthBinding = estimateAttachmentWidth;
const trailingIconBinding = trailingIcon;
const binding = env0_0;
return estimateAttachmentWidthBinding(trailingIconBinding,
binding.trailingIcon.paddingStart + binding.trailingIcon.paddingEnd);
}
}
}
global.__d(_fun55400, 6991, [57, 31, 27, 33, 6817, 4573, 1357, 6992,
2]) /* metro module 6991, dependencies: [57, 31, 27, 33, 6817, 4573, 1357, 6992, 2] */;