decord/source/design/components/Button/native/ImageButton.native.tsx

139 lines
5.9 KiB
TypeScript
Raw Normal View History

// Module ID: 9895
// Function ID: 9896
2026-07-20 16:05:17 +00:00
// Name: ImageButton
// Dependencies: [19, 17, 21, 4560, 4980, 576, 4981, 4296, 4974, 4978, 4983, 8098, 4556, 2]
2026-07-20 16:05:17 +00:00
// Module 9895 (ImageButton)
import ThemesDefault from "Themes" /* 576 */;
import MINIMUM_HIT_AREA from "MINIMUM_HIT_AREA" /* 4980 */;
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4560 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
let c3 = importAllResult;
({ View: c4, Image: c5 } = get_ActivityIndicator);
({ jsx: closure_6, jsxs: error } = jsxProd);
let closure_8 = createCacheKey.createStyles((arg0, arg1, arg2) => {
2026-08-24 06:08:38 +00:00
let MEDIUM_BUTTON_PADDING = MINIMUM_HIT_AREA.LARGE_BUTTON_PADDING;
2026-07-20 16:05:17 +00:00
if ("sm" === arg0) {
MEDIUM_BUTTON_PADDING = tmp(4980).SMALL_BUTTON_PADDING;
2026-07-20 16:05:17 +00:00
} else if ("md" === arg0) {
MEDIUM_BUTTON_PADDING = tmp(4980).MEDIUM_BUTTON_PADDING;
2026-07-20 16:05:17 +00:00
}
const sum = arg1 + 2 * MEDIUM_BUTTON_PADDING;
2026-08-24 06:08:38 +00:00
const buttonBorderRadius = MINIMUM_HIT_AREA.getButtonBorderRadius(arg0);
let obj = { paddingBottom: ThemesDefault.space.PX_4, gap: ThemesDefault.space.PX_8, alignItems: "center", alignSelf: "center", flexGrow: null };
2026-07-20 16:05:17 +00:00
let num = 0;
if (arg2) {
num = 1;
}
2026-08-24 06:08:38 +00:00
obj = { labelPressable: obj, pill: null, imageWrapper: null, image: null, imageDim: num };
const tmpResult = MINIMUM_HIT_AREA;
obj[1] = { paddingHorizontal: 0, paddingVertical: 0, minHeight: sum, minWidth: sum, borderRadius: buttonBorderRadius, borderWidth: 0, outlineWidth: MINIMUM_HIT_AREA.BUTTON_BORDER_WIDTH, outlineColor: ThemesDefault.colors.CONTROL_SECONDARY_BORDER_DEFAULT, outlineStyle: "solid" };
2026-07-29 08:29:29 +00:00
obj[2] = { width: sum, height: sum, position: "relative" };
obj[3] = { width: sum, height: sum };
2026-08-24 06:08:38 +00:00
obj1 = { paddingHorizontal: 0, paddingVertical: 0, minHeight: sum, minWidth: sum, borderRadius: buttonBorderRadius, borderWidth: 0, outlineWidth: MINIMUM_HIT_AREA.BUTTON_BORDER_WIDTH, outlineColor: ThemesDefault.colors.CONTROL_SECONDARY_BORDER_DEFAULT, outlineStyle: "solid" };
obj[4] = { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, backgroundColor: ThemesDefault.colors.REDESIGN_IMAGE_BUTTON_PRESSED_BACKGROUND, borderRadius: buttonBorderRadius };
2026-07-20 16:05:17 +00:00
return obj;
});
let closure_9 = { code: "function ImageButtonNativeTsx1(){const{withSpring,pressed,ON_PRESS_SPRING}=this.__closure;return{opacity:withSpring(pressed.get()===1?1:0,ON_PRESS_SPRING,'animate-always')};}" };
2026-07-29 08:29:29 +00:00
const forwardRefResult = importAllResult.forwardRef((size) => {
2026-07-20 16:05:17 +00:00
let str = size.size;
if (str === undefined) {
str = "lg";
}
({ label, accessibilityLabel, maxFontSizeMultiplier, onPressIn } = size);
const onPressOut = size.onPressOut;
({ grow, image } = size);
2026-07-29 08:29:29 +00:00
const merged = Object.assign(size, Object.create(null));
2026-07-23 10:11:24 +00:00
let sharedValue;
2026-07-29 08:29:29 +00:00
let obj = onPressIn(sharedValue[6]);
const tmp4 = callback3(str, obj.useIconSizeStyles(str, true, maxFontSizeMultiplier).width, grow);
2026-08-24 06:08:38 +00:00
obj1 = onPressIn(sharedValue[7]);
2026-07-29 08:29:29 +00:00
sharedValue = obj1.useSharedValue(0);
2026-07-20 16:05:17 +00:00
const items = [sharedValue, onPressIn];
const callback = importAllResult.useCallback((arg0) => {
const result = sharedValue.set(1);
2026-07-29 08:29:29 +00:00
if (onPressIn != null) {
tmp2(arg0);
2026-07-20 16:05:17 +00:00
}
}, items);
const items1 = [sharedValue, onPressOut];
const callback1 = importAllResult.useCallback((arg0) => {
const result = sharedValue.set(0);
2026-07-29 08:29:29 +00:00
if (onPressOut != null) {
tmp2(arg0);
2026-07-20 16:05:17 +00:00
}
}, items1);
2026-07-29 08:29:29 +00:00
let obj2 = onPressIn(sharedValue[7]);
2026-07-25 08:10:48 +00:00
class B {
constructor() {
2026-07-29 08:29:29 +00:00
tmp = onPressIn;
2026-08-24 06:08:38 +00:00
tmp2 = closure_2;
obj = onPressIn(closure_2[8]);
2026-07-25 08:10:48 +00:00
num = 0;
2026-08-24 06:08:38 +00:00
if (1 === closure_2.get()) {
2026-07-25 08:10:48 +00:00
num = 1;
}
2026-07-29 08:29:29 +00:00
obj = { opacity: obj.withSpring(num, tmp(tmp2[9]).ON_PRESS_SPRING, "animate-always") };
2026-07-25 08:10:48 +00:00
return obj;
2026-07-20 16:05:17 +00:00
}
2026-07-25 08:10:48 +00:00
}
2026-07-23 10:11:24 +00:00
obj = { withSpring: onPressIn(sharedValue[8]).withSpring, pressed: sharedValue, ON_PRESS_SPRING: onPressIn(sharedValue[9]).ON_PRESS_SPRING };
2026-07-25 08:10:48 +00:00
B.__closure = obj;
B.__workletHash = 17257158773379;
B.__initData = closure_9;
2026-07-29 08:29:29 +00:00
obj = { style: tmp4.imageWrapper, children: null };
obj1 = { source: image, style: tmp4.image };
const animatedStyle = obj2.useAnimatedStyle(B);
2026-07-20 16:05:17 +00:00
const items2 = [callback(closure_5, obj1), ];
2026-07-29 08:29:29 +00:00
const items3 = [tmp4.imageDim, animatedStyle];
2026-07-23 10:11:24 +00:00
items2[1] = callback(onPressOut(sharedValue[7]).View, { style: items3 });
2026-07-29 08:29:29 +00:00
obj[1] = items2;
const tmp11 = callback2(closure_4, obj);
2026-07-20 16:05:17 +00:00
if (null != label) {
2026-07-29 08:29:29 +00:00
obj2 = { style: null };
obj2[0] = tmp4.labelPressable;
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
obj2.variant = "none";
obj2.accessibilityLabel = accessibilityLabel;
const obj3 = { ref: null };
obj3[0] = arg1;
2026-07-20 16:05:17 +00:00
const merged2 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
obj3.icon = tmp11;
obj3.accessibilityRole = "none";
obj3.accessibilityLabel = "";
obj3.size = "lg";
obj3.pillStyle = tmp4.pill;
obj3.variant = "secondary";
obj3.onPressIn = callback;
obj3.onPressOut = callback1;
obj3.maxFontSizeMultiplier = maxFontSizeMultiplier;
const items4 = [tmp10(tmp2(tmp3[11]).BaseIconButton, obj3), ];
const obj4 = { variant: "text-xs/medium", color: "interactive-text-default", maxFontSizeMultiplier: null, children: null };
obj4[2] = maxFontSizeMultiplier;
obj4[3] = label;
items4[1] = tmp10(tmp2(tmp3[12]).Text, obj4);
obj2.children = items4;
let tmp10Result = callback2(tmp2(tmp3[10]).BaseButton, obj2);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj5 = { ref: null };
obj5[0] = arg1;
2026-07-20 16:05:17 +00:00
const merged3 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
obj5.size = str;
obj5.icon = tmp11;
obj5.accessibilityLabel = accessibilityLabel;
obj5.pillStyle = tmp4.pill;
obj5.variant = "secondary";
obj5.onPressIn = callback;
obj5.onPressOut = callback1;
tmp10Result = tmp10(tmp2(tmp3[11]).BaseIconButton, obj5);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp10Result;
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("design/components/Button/native/ImageButton.native.tsx");
2026-07-20 16:05:17 +00:00
export const ImageButton = forwardRefResult;