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

122 lines
6.8 KiB
TypeScript

/* Metro module 8342; source: design/components/Button/native/BaseIconButton.native.tsx; dependencies: [31, 33, 4501, 4582, 4017, 4580, 4583, 4585, 4587, 2] */
import ReanimatedRexport from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import Icon from '../../../void/Icon/native/Icon.tsx'; /* Metro dependency 4580 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
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 CreateStylesModule from '../../Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as ButtonHooksNativeModule from './ButtonHooks.native.tsx'; /* Metro dependency 4583 */
import * as BaseButtonNativeModule from './BaseButton.native.tsx'; /* Metro dependency 4585 */
import * as ButtonPillNativeModule from './ButtonPill.native.tsx'; /* Metro dependency 4587 */
function _fun66438(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8527:6, offset: 0x01bfb458, size: 221 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const env0_4 = (CreateStylesModule).createStyles(_fun66439);
const env0_5 = (ReanimatedRexport).createAnimatedComponent(Icon);
value = value.forwardRef(_fun66440);
(FileImportTrackerModule).fileFinishedImporting('design/components/Button/native/BaseIconButton.native.tsx');
exports.BaseIconButton = value;
function _fun66439(a0, a1) { // fn#66439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8527:144, offset: 0x01bfb535, size: 259 bytes, params: 3, frame: 16
var r6;
var r2;
var LARGE_BUTTON_PADDING;
var MEDIUM_BUTTON_PADDING;
var SMALL_BUTTON_PADDING;
let object = {};
if (a1 === 'sm') {
object = {};
SMALL_BUTTON_PADDING = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).SMALL_BUTTON_PADDING;
object.paddingHorizontal = SMALL_BUTTON_PADDING;
object.paddingVertical = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).SMALL_BUTTON_PADDING;
r2 = object;
r6 = SMALL_BUTTON_PADDING;
} else if (a1 === 'md') {
object = {};
MEDIUM_BUTTON_PADDING = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MEDIUM_BUTTON_PADDING;
object.paddingHorizontal = MEDIUM_BUTTON_PADDING;
object.paddingVertical = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MEDIUM_BUTTON_PADDING;
r2 = object;
r6 = MEDIUM_BUTTON_PADDING;
} else if (a1 !== 'lg') {
r2 = object;
} else {
object = {};
LARGE_BUTTON_PADDING = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).LARGE_BUTTON_PADDING;
object.paddingHorizontal = LARGE_BUTTON_PADDING;
object.paddingVertical = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).LARGE_BUTTON_PADDING;
r2 = object;
r6 = LARGE_BUTTON_PADDING;
}
const object2 = {};
copyDataProperties(object2, r2, r6);
return {button: {'flexShrink': 0, 'flexGrow': 0, 'alignSelf': 'center'}, pill: object2};
}
function _fun66440(a0, a1) { // fn#66440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8527:638, offset: 0x01bfb638, size: 595 bytes, params: 3, frame: 34
var r14;
const style = a0.style;
const pillStyle = a0.pillStyle;
const variant = a0.variant;
const r13 = variant === undefined ? 'primary' : variant;
const size = a0.size;
if (size !== undefined) {
r14 = size;
} else {
value = environment;
r14 = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).DEFAULT_BUTTON_SIZE;
}
const maxFontSizeMultiplier = a0.maxFontSizeMultiplier;
const loading = a0.loading;
const icon = a0.icon;
const scaleAmountInPx = a0.scaleAmountInPx;
const r19 = scaleAmountInPx === undefined ? 4 : scaleAmountInPx;
const styles = useStyles(r13, r14);
value = require(dependencyMap[value]);
value = value.useSharedValue(0);
const value3 = (ButtonHooksNativeModule).useIconTintStyles(r13);
const value4 = (ButtonHooksNativeModule).useIconSizeStyles(r14, true,
maxFontSizeMultiplier);
const LARGE_BUTTON_HEIGHT = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).LARGE_BUTTON_HEIGHT;
const value5 = 'sm';
const r21 = value5 === r14 ? (require(4582) /* metro dependency 4582: ButtonConstantsNative */).SMALL_BUTTON_HEIGHT : r14 !== 'md' ? LARGE_BUTTON_HEIGHT : (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MEDIUM_BUTTON_HEIGHT;
const Math = global.Math;
const max = Math.max;
const MINIMUM_HIT_AREA = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MINIMUM_HIT_AREA;
const value6 = Reflect.apply(max, Math, [(MINIMUM_HIT_AREA - r21) / 2, 0]);
const BaseButton = (BaseButtonNativeModule).BaseButton;
const baseButtonProps = {...a0};
baseButtonProps['ref'] = a1;
baseButtonProps['style'] = [styles.button, style];
baseButtonProps['pressed'] = value;
baseButtonProps['scaleAmountInPx'] = r19;
baseButtonProps['hitSlop'] = value6;
const ButtonPill = (ButtonPillNativeModule).ButtonPill;
const binding = env0_2;
return (
<BaseButton {...baseButtonProps}>
<ButtonPill
style={[styles.pill, pillStyle]}
variant={r13}
size={r14}
loading={loading}
loaderSize={r14 !== 'lg' ? 'xs' : value5}
pressed={value}
>
{
binding.isValidElement(icon)
? icon
: ((Component) => <Component source={icon} style={[value3, value4]} />)(env0_5)
}
</ButtonPill>
</BaseButton>
);
}
}
global.__d(_fun66438, 8342, [31, 33, 4501, 4582, 4017, 4580, 4583, 4585, 4587,
2]) /* metro module 8342, dependencies: [31, 33, 4501, 4582, 4017, 4580, 4583, 4585, 4587, 2] */;