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

191 lines
6.1 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 4752
// Function ID: 4753
2026-07-20 16:05:17 +00:00
// Name: BaseButton
2026-08-15 05:55:55 +00:00
// Dependencies: [109, 19, 17, 4753, 21, 4104, 4661, 4750, 4115, 1370, 500, 2]
2026-07-23 10:11:24 +00:00
2026-08-15 05:55:55 +00:00
// Module 4752 (BaseButton)
2026-07-23 10:11:24 +00:00
import _objectWithoutProperties from "_objectWithoutProperties";
2026-07-29 08:29:29 +00:00
import importAllResult from "noop";
2026-07-23 10:11:24 +00:00
import get_ActivityIndicator from "get ActivityIndicator";
import { IOS_POINTER_STYLE } from "IOS_POINTER_STYLE";
import { jsx } from "jsxProd";
2026-07-29 08:29:29 +00:00
import createCacheKey from "createCacheKey";
2026-08-15 05:55:55 +00:00
import importDefaultResult from "module_4115";
import importDefaultResult1 from "module_4115";
2026-07-20 16:05:17 +00:00
let Pressable;
let TouchableOpacity;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-04 08:36:32 +00:00
let closure_2 = ["style"];
let c4 = importAllResult;
2026-07-23 10:11:24 +00:00
({ Pressable, TouchableOpacity } = get_ActivityIndicator);
2026-08-04 08:36:32 +00:00
let closure_7 = createCacheKey.createStyles({ disabled: { opacity: 0.5 } });
2026-08-15 05:55:55 +00:00
let closure_8 = require("module_4115").createAnimatedComponent(Pressable);
let closure_9 = require("module_4115").createAnimatedComponent(TouchableOpacity);
2026-07-29 08:29:29 +00:00
const forwardRefResult = importAllResult.forwardRef((disabled, ref) => {
2026-07-20 16:05:17 +00:00
let accessibilityActions;
let accessibilityElementsHidden;
let accessibilityHint;
let accessibilityLabel;
let accessibilityRole;
let accessibilityState;
let accessibilityValue;
let accessible;
let children;
let hitSlop;
let importantForAccessibility;
let onAccessibilityAction;
let onLayout;
let onLongPress;
let onPress;
let onPressDisabled;
let onPressIn;
let onPressOut;
let pointerEvents;
let pressed;
let scaleAmountInPx;
let variant;
({ children, variant } = disabled);
if (variant === undefined) {
variant = "primary";
}
let flag = disabled.disabled;
if (flag === undefined) {
flag = false;
}
let flag2 = disabled.loading;
if (flag2 === undefined) {
flag2 = false;
}
({ pressed, onPress, onPressDisabled, onPressIn, onPressOut, onLayout, accessible, accessibilityRole, accessibilityLabel, accessibilityHint, accessibilityState } = disabled);
({ accessibilityElementsHidden, importantForAccessibility, hitSlop, scaleAmountInPx } = disabled);
2026-08-04 08:36:32 +00:00
let c2;
2026-07-23 10:11:24 +00:00
let buttonAnimationProps;
2026-07-20 16:05:17 +00:00
({ onLongPress, accessibilityValue, accessibilityActions, onAccessibilityAction, pointerEvents } = disabled);
let tmp2 = flag;
if (flag) {
tmp2 = null == onPressDisabled;
}
2026-08-04 08:36:32 +00:00
c2 = tmp2;
2026-07-20 16:05:17 +00:00
if (flag) {
onPress = onPressDisabled;
}
2026-08-04 08:36:32 +00:00
let obj = flag2(accessibilityState[7]);
2026-07-20 16:05:17 +00:00
const buttonPressAnimationProps = obj.useButtonPressAnimationProps(pressed, scaleAmountInPx, onLayout, onPressIn, onPressOut);
if (null == pressed) {
2026-08-13 17:34:28 +00:00
obj = { animatedScaleStyles: "Array", buttonAnimationProps: 0 };
2026-07-29 08:29:29 +00:00
obj = { onLayout: null, onPressIn: null, onPressOut: null };
obj[0] = onLayout;
obj[1] = onPressIn;
obj[2] = onPressOut;
obj[1] = obj;
2026-07-20 16:05:17 +00:00
let obj1 = obj;
} else {
2026-07-29 08:29:29 +00:00
obj1 = { animatedScaleStyles: null, buttonAnimationProps: null };
obj1[0] = buttonPressAnimationProps.style;
obj1[1] = tmp7;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
buttonAnimationProps = obj1.buttonAnimationProps;
2026-07-20 16:05:17 +00:00
const items = [accessibilityState, tmp2, flag2];
const memo = importAllResult.useMemo(() => {
const obj = {};
const merged = Object.assign(accessibilityState);
2026-07-29 08:29:29 +00:00
obj.disabled = c2;
obj.busy = flag2;
2026-07-20 16:05:17 +00:00
return obj;
}, items);
2026-08-04 08:36:32 +00:00
let tmp4Result = tmp4(tmp5[5]);
2026-07-20 16:05:17 +00:00
let str = "light";
if ("primary-overlay" !== variant) {
let str3;
if ("secondary-overlay" === variant) {
2026-07-29 08:29:29 +00:00
if ("light" === tmp10) {
2026-07-20 16:05:17 +00:00
str3 = "dark";
}
}
str = str3;
}
2026-07-29 08:29:29 +00:00
let tmp11 = children;
2026-07-20 16:05:17 +00:00
if (null != str) {
2026-07-29 08:29:29 +00:00
const obj2 = { theme: null, children: null };
obj2[0] = str;
obj2[1] = children;
2026-08-04 08:36:32 +00:00
tmp11 = jsx(tmp4(tmp5[5]).ThemeContextProvider, { theme: null, children: null });
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
const items1 = [disabled.style, , , ];
2026-07-20 16:05:17 +00:00
if (flag) {
flag = tmp.disabled;
}
2026-08-04 08:36:32 +00:00
items1[1] = flag;
items1[2] = obj1.animatedScaleStyles;
items1[3] = IOS_POINTER_STYLE;
2026-07-20 16:05:17 +00:00
if ("none" !== accessibilityRole) {
const obj3 = {};
2026-07-23 10:11:24 +00:00
let merged = Object.assign(buttonAnimationProps);
2026-07-29 08:29:29 +00:00
obj3.ref = ref;
obj3.accessible = accessible;
if (accessibilityRole == null) {
accessibilityRole = "button";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj3.accessibilityRole = accessibilityRole;
obj3.accessibilityLabel = accessibilityLabel;
obj3.accessibilityHint = accessibilityHint;
obj3.accessibilityValue = accessibilityValue;
obj3.accessibilityState = memo;
obj3.accessibilityActions = accessibilityActions;
obj3.onAccessibilityAction = onAccessibilityAction;
obj3.accessibilityElementsHidden = accessibilityElementsHidden;
obj3.importantForAccessibility = importantForAccessibility;
obj3.pointerEvents = pointerEvents;
obj3.style = items1;
obj3.onPress = onPress;
obj3.onLongPress = onLongPress;
obj3.disabled = tmp2;
obj3.hitSlop = hitSlop;
obj3.children = tmp11;
2026-08-04 08:36:32 +00:00
return <closure_8 />;
2026-07-20 16:05:17 +00:00
} else {
let str5 = "";
if (!accessibilityElementsHidden) {
const items2 = [accessibilityLabel, accessibilityHint];
2026-08-04 08:36:32 +00:00
const found = items2.filter(tmp4(tmp5[9]).isNotNullish);
2026-07-20 16:05:17 +00:00
str5 = found.join(", ");
}
const obj4 = {};
const merged1 = Object.assign(buttonAnimationProps);
2026-07-29 08:29:29 +00:00
obj4.ref = ref;
2026-07-20 16:05:17 +00:00
let isAndroidResult = accessible;
2026-07-29 08:29:29 +00:00
if (accessible == null) {
2026-08-04 08:36:32 +00:00
tmp4Result = tmp4(tmp5[10]);
2026-07-29 08:29:29 +00:00
isAndroidResult = tmp4Result.isAndroid();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj4.accessible = !isAndroidResult;
obj4.accessibilityRole = "none";
obj4.accessibilityLabel = str5;
obj4.accessibilityElementsHidden = accessibilityElementsHidden;
obj4.activeOpacity = 1;
obj4.importantForAccessibility = importantForAccessibility;
obj4.style = items1;
obj4.onPress = onPress;
obj4.onPressIn = function onPressIn(arg0) {
const onPressIn = buttonAnimationProps.onPressIn;
if (onPressIn != null) {
onPressIn(arg0);
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj4.onPressOut = function onPressOut(arg0) {
const onPressOut = buttonAnimationProps.onPressOut;
if (onPressOut != null) {
onPressOut(arg0);
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj4.hitSlop = hitSlop;
obj4.children = tmp11;
2026-08-04 08:36:32 +00:00
return <closure_9 />;
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
tmp = callback();
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
const result = require("get ActivityIndicator").fileFinishedImporting("design/components/Button/native/BaseButton.native.tsx");
2026-07-20 16:05:17 +00:00
export const BaseButton = forwardRefResult;