decord/source/design/components/Tabs/native/TabItem.native.tsx

182 lines
7.7 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11833
// Function ID: 11834
2026-07-29 08:29:29 +00:00
// Name: TabItemCount
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 17, 21, 4119, 4668, 712, 4749, 4739, 500, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: TabItem
2026-08-24 06:08:38 +00:00
// Module 11833 (TabItemCount)
import ThemesDefault from "Themes" /* 712 */;
import closure_3 from "noop" /* 19 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
import importDefaultResult from "module_4119" /* 4119 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function TabItemCount(arg0) {
2026-07-29 08:29:29 +00:00
({ index, activeIndex, pressed } = arg0);
index = undefined;
({ count, variant } = arg0);
let obj = index(pressed[3]);
const sharedValue = obj.useSharedValue(0);
index = sharedValue;
2026-07-23 10:11:24 +00:00
let items = [sharedValue];
2026-07-20 16:05:17 +00:00
const layoutEffect = React.useLayoutEffect(() => {
2026-07-29 08:29:29 +00:00
const result = index.set(1);
2026-07-20 16:05:17 +00:00
}, items);
2026-08-24 06:08:38 +00:00
obj1 = index(pressed[3]);
2026-07-20 16:05:17 +00:00
class T {
constructor() {
2026-07-29 08:29:29 +00:00
obj = { opacity: null, transform: null };
obj2 = index(pressed[6]);
2026-08-24 06:08:38 +00:00
obj[0] = obj2.withSpring(index.get(), closure_1_8);
2026-07-29 08:29:29 +00:00
obj = { translateX: null };
obj4 = index(pressed[6]);
obj5 = index(pressed[3]);
2026-08-24 06:08:38 +00:00
obj[0] = obj4.withSpring(obj5.interpolate(index.get(), [0, 1], [-10, 0]), closure_1_8);
2026-07-29 08:29:29 +00:00
items = [];
items[0] = obj;
obj[1] = items;
2026-07-20 16:05:17 +00:00
return obj;
}
}
2026-07-29 08:29:29 +00:00
obj = { withSpring: index(pressed[6]).withSpring, countAnimationState: sharedValue, COUNT_SPRING_CONFIG: closure_8, interpolate: index(pressed[3]).interpolate };
2026-07-20 16:05:17 +00:00
T.__closure = obj;
T.__workletHash = 16666672974627;
T.__initData = closure_13;
2026-07-29 08:29:29 +00:00
React = undefined;
2026-07-21 22:01:30 +00:00
const animatedStyle = obj1.useAnimatedStyle(T);
2026-08-24 06:08:38 +00:00
let tmp7 = callback3();
2026-07-29 08:29:29 +00:00
if ("gradient-background" === variant) {
2026-08-24 06:08:38 +00:00
tmp7 = callback4();
2026-07-29 08:29:29 +00:00
}
React = tmp7;
2026-07-21 22:01:30 +00:00
const tmp = callback2();
2026-07-29 08:29:29 +00:00
const fn = function c() {
2026-08-24 06:08:38 +00:00
let active = inactive.inactive;
2026-07-29 08:29:29 +00:00
const value = pressed.get();
if (value === index) {
active = tmp.pressed;
} else if (tmp2) {
active = tmp.inactive;
} else if (tmp5 === tmp4) {
active = tmp.active;
}
const obj = { color: null };
tmp2 = pressed.get() >= 0;
tmp4 = index;
2026-08-24 06:08:38 +00:00
obj[0] = index(pressed[6]).withSpring(active, closure_1_7, "animate-always");
2026-07-29 08:29:29 +00:00
return obj;
};
obj = { colors: tmp7, pressed, index, activeIndex, withSpring: tmp2(tmp3[6]).withSpring, TEXT_SPRING_CONFIG: closure_7 };
fn.__closure = obj;
fn.__workletHash = 11643476765161;
fn.__initData = closure_12;
const animatedStyle1 = index(pressed[3]).useAnimatedStyle(fn);
2026-08-24 06:08:38 +00:00
obj1 = { style: items1, children: callback(tmp2(tmp3[7]).Text, { animated: true, variant: "text-sm/medium", style: animatedStyle1, lineClamp: 1, children: count }) };
2026-07-23 10:11:24 +00:00
items1 = [tmp.count, animatedStyle];
2026-07-29 08:29:29 +00:00
return callback(activeIndex(pressed[3]).View, obj1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
({ jsx: c4, jsxs: c5 } = jsxProd);
2026-08-24 06:08:38 +00:00
let closure_6 = importDefaultResult.createAnimatedComponent(require("get ActivityIndicator").Pressable);
2026-07-23 10:11:24 +00:00
let closure_7 = { mass: 0.3, damping: 13, stiffness: 250, overshootClamping: true };
let closure_8 = { mass: 2, damping: 30, stiffness: 300, overshootClamping: true };
2026-07-29 08:29:29 +00:00
let obj = { item: { flexShrink: 0, flexBasis: 0, paddingBottom: 14, flexDirection: "row", justifyContent: "center" }, count: null };
2026-08-24 06:08:38 +00:00
obj = { marginLeft: ThemesDefault.space.PX_8 };
2026-07-29 08:29:29 +00:00
obj[1] = obj;
let closure_9 = createCacheKey.createStyles(obj);
2026-08-24 06:08:38 +00:00
createCacheKey = { inactive: ThemesDefault.colors.TEXT_MUTED, active: ThemesDefault.colors.TEXT_BRAND, pressed: ThemesDefault.colors.TEXT_BRAND };
let closure_10 = createCacheKey.createStyleProperties(createCacheKey);
let closure_11 = createCacheKey.createStyleProperties({ inactive: ThemesDefault.colors.TEXT_MUTED, active: ThemesDefault.colors.TEXT_STRONG, pressed: ThemesDefault.colors.TEXT_STRONG });
2026-07-20 16:05:17 +00:00
let closure_12 = { code: "function TabItemNativeTsx1(){const{colors,pressed,index,activeIndex,withSpring,TEXT_SPRING_CONFIG}=this.__closure;let color=colors.inactive;const isPressActive=pressed.get()>=0;const isPressed=pressed.get()===index;const isActive=Math.round(activeIndex.get())===index;if(isPressed){color=colors.pressed;}else if(isPressActive){color=colors.inactive;}else if(isActive){color=colors.active;}return{color:withSpring(color,TEXT_SPRING_CONFIG,'animate-always')};}" };
let closure_13 = { code: "function TabItemNativeTsx2(){const{withSpring,countAnimationState,COUNT_SPRING_CONFIG,interpolate}=this.__closure;return{opacity:withSpring(countAnimationState.get(),COUNT_SPRING_CONFIG),transform:[{translateX:withSpring(interpolate(countAnimationState.get(),[0,1],[-10,0]),COUNT_SPRING_CONFIG)}]};}" };
2026-07-29 08:29:29 +00:00
let closure_15 = { code: "function TabItemNativeTsx3(){const{activeIndex,index}=this.__closure;return{accessibilityState:{selected:activeIndex.get()===index}};}" };
2026-08-24 06:08:38 +00:00
let obj2 = { inactive: ThemesDefault.colors.TEXT_MUTED, active: ThemesDefault.colors.TEXT_STRONG, pressed: ThemesDefault.colors.TEXT_STRONG };
let result = require("set").fileFinishedImporting("design/components/Tabs/native/TabItem.native.tsx");
2026-07-20 16:05:17 +00:00
export const TabItem = function TabItem(arg0) {
({ count, index } = arg0);
({ state, pressed, variant } = arg0);
({ label, itemCount, grow } = arg0);
2026-07-29 08:29:29 +00:00
const merged = Object.assign(arg0, Object.create(null));
let activeIndex;
pressed = undefined;
activeIndex = state.activeIndex;
pressed = state.setItemDimensions;
let obj = index(pressed[3]);
2026-07-20 16:05:17 +00:00
const fn = function f() {
2026-07-29 08:29:29 +00:00
let obj = { accessibilityState: null };
2026-07-20 16:05:17 +00:00
obj = { selected: activeIndex.get() === index };
2026-07-29 08:29:29 +00:00
obj[0] = obj;
2026-07-20 16:05:17 +00:00
return obj;
};
fn.__closure = { activeIndex, index };
fn.__workletHash = 11618929630200;
2026-07-29 08:29:29 +00:00
fn.__initData = closure_15;
2026-08-24 06:08:38 +00:00
closure_3 = undefined;
2026-07-29 08:29:29 +00:00
const animatedProps = obj.useAnimatedProps(fn);
2026-08-24 06:08:38 +00:00
let tmp6 = callback3();
2026-07-29 08:29:29 +00:00
if ("gradient-background" === variant) {
2026-08-24 06:08:38 +00:00
tmp6 = callback4();
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
closure_3 = tmp6;
2026-07-29 08:29:29 +00:00
let tmp3Result = tmp3(tmp4[3]);
const fn2 = function c() {
2026-08-24 06:08:38 +00:00
let active = inactive.inactive;
2026-07-29 08:29:29 +00:00
const value = pressed.get();
if (value === index) {
active = tmp.pressed;
} else if (tmp2) {
active = tmp.inactive;
} else if (tmp5 === tmp4) {
active = tmp.active;
}
const obj = { color: null };
tmp2 = pressed.get() >= 0;
tmp4 = index;
2026-08-24 06:08:38 +00:00
obj[0] = index(pressed[6]).withSpring(active, closure_1_7, "animate-always");
2026-07-29 08:29:29 +00:00
return obj;
};
obj = { colors: tmp6, pressed, index, activeIndex, withSpring: tmp3(tmp4[6]).withSpring, TEXT_SPRING_CONFIG: closure_7 };
fn2.__closure = obj;
fn2.__workletHash = 11643476765161;
fn2.__initData = closure_12;
2026-07-20 16:05:17 +00:00
const items = [callback2().item, ];
let num = 0;
2026-07-29 08:29:29 +00:00
const animatedStyle = tmp3Result.useAnimatedStyle(fn2);
2026-07-20 16:05:17 +00:00
if (grow) {
num = 1;
}
2026-07-29 08:29:29 +00:00
obj = { style: items };
items[1] = { flexGrow: num };
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
obj.onLayout = function onLayout(nativeEvent) {
index(pressed[3]).runOnUI(pressed)(index, nativeEvent.nativeEvent.layout);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
obj.accessibilityRole = "tab";
tmp3Result = tmp3(tmp4[8]);
2026-07-20 16:05:17 +00:00
let formatToPlainStringResult;
2026-07-29 08:29:29 +00:00
if (tmp3Result.isAndroid()) {
const intl = tmp3(tmp4[9]).intl;
2026-08-24 06:08:38 +00:00
obj1 = { position: null, tabCount: null };
2026-07-29 08:29:29 +00:00
obj1[0] = index + 1;
obj1[1] = itemCount;
formatToPlainStringResult = intl.formatToPlainString(tmp3(tmp4[9]).t["4EsQA1"], obj1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.accessibilityHint = formatToPlainStringResult;
obj.animatedProps = animatedProps;
const items1 = [callback(index(pressed[7]).Text, { animated: true, variant: "text-sm/semibold", style: animatedStyle, lineClamp: 1, children: label }), ];
let tmp12Result = null;
2026-07-20 16:05:17 +00:00
if (null != count) {
2026-07-29 08:29:29 +00:00
const obj2 = { count: null, index: null, activeIndex: null, pressed: null, variant: null };
obj2[0] = count;
obj2[1] = index;
obj2[2] = activeIndex;
obj2[3] = pressed;
obj2[4] = variant;
tmp12Result = callback(TabItemCount, obj2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
items1[1] = tmp12Result;
obj.children = items1;
return closure_5(closure_6, obj);
2026-07-20 16:05:17 +00:00
};