decord/source/design/components/Tabs/native/TabItem.native.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

182 lines
8.3 KiB
TypeScript

// Module ID: 12685
// Function ID: 12686
// Name: TabItem
// Dependencies: [19, 17, 21, 4341, 4605, 576, 5024, 4601, 1115, 1114, 2]
// Exports: TabItem
// Module 12685 (TabItem)
import nativeDefault from "native" /* 576 */;
import ReanimatedRexport2 from "ReanimatedRexport" /* 4341 */;
import spring from "spring" /* 5024 */;
import noop from "module_19" /* 19 */;
const ReanimatedRexport = ReanimatedRexport2;
require = fn;
function TabItemCount(arg0) {
({ index, activeIndex, pressed } = arg0);
let sharedValue;
({ count, variant } = arg0);
const tmp = closure_9();
sharedValue = sharedValue(4341).useSharedValue(0);
let items = [sharedValue];
const layoutEffect = noop.useLayoutEffect(() => {
const result = sharedValue.set(1);
}, items);
let obj = sharedValue(4341);
class T {
constructor() {
obj = { opacity: null, transform: null };
obj2 = closure_0(closure_2[6]);
obj.opacity = obj2.withSpring(closure_0.get(), closure_8);
obj1 = { translateX: null };
obj4 = closure_0(closure_2[6]);
obj5 = closure_0(closure_2[3]);
obj1.translateX = obj4.withSpring(obj5.interpolate(closure_0.get(), [0, 1], [-10, 0]), closure_8);
items = [];
items[0] = obj1;
obj.transform = items;
return obj;
}
}
let obj2 = sharedValue(4341);
T.__closure = { withSpring: sharedValue(5024).withSpring, countAnimationState: sharedValue, COUNT_SPRING_CONFIG, interpolate: sharedValue(4341).interpolate };
T.__workletHash = 16666672974627;
T.__initData = __initData2;
closure_129_0 = index;
closure_129_1 = activeIndex;
closure_129_2 = pressed;
closure_129_3 = undefined;
const animatedStyle = obj2.useAnimatedStyle(T);
let tmp7 = closure_10();
if ("gradient-background" === variant) {
tmp7 = closure_11();
}
closure_129_3 = tmp7;
let obj3 = { withSpring: sharedValue(5024).withSpring, countAnimationState: sharedValue, COUNT_SPRING_CONFIG, interpolate: sharedValue(4341).interpolate };
const fn = function c() {
let active = inactive.inactive;
value = setItemDimensions.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 = setItemDimensions.get() >= 0;
tmp4 = index;
obj.color = spring.withSpring(active, closure_7, "animate-always");
return obj;
};
const tmp2Result = sharedValue(4341);
fn.__closure = { colors: tmp7, pressed, index, activeIndex, withSpring: sharedValue(5024).withSpring, TEXT_SPRING_CONFIG };
fn.__workletHash = 11643476765161;
fn.__initData = __initData;
const animatedStyle1 = tmp2Result.useAnimatedStyle(fn);
const obj5 = { style: null, children: closure_4(sharedValue(4601).Text, { animated: true, variant: "text-sm/medium", style: animatedStyle1, lineClamp: 1, children: count }) };
const items1 = [tmp.count, animatedStyle];
obj5.style = items1;
return closure_4(ReanimatedRexport.View, obj5);
}
const jsxProd = fn(21);
({ jsx: closure_4, jsxs: hasOwnProperty } = jsxProd);
let closure_6 = ReanimatedRexport.createAnimatedComponent(fn(17).Pressable);
const TEXT_SPRING_CONFIG = { mass: 0.3, damping: 13, stiffness: 250, overshootClamping: true };
const COUNT_SPRING_CONFIG = { mass: 2, damping: 30, stiffness: 300, overshootClamping: true };
let createStyles = fn(4605);
let obj = { item: { flexShrink: 0, flexBasis: 0, paddingBottom: 14, flexDirection: "row", justifyContent: "center" }, count: { marginLeft: nativeDefault.space.PX_8 } };
let closure_9 = createStyles.createStyles(obj);
createStyles = fn(4605);
let obj3 = { marginLeft: nativeDefault.space.PX_8 };
let closure_10 = createStyles.createStyleProperties({ inactive: nativeDefault.colors.TEXT_MUTED, active: nativeDefault.colors.TEXT_BRAND, pressed: nativeDefault.colors.TEXT_BRAND });
createStyles = fn(4605);
let obj4 = { inactive: nativeDefault.colors.TEXT_MUTED, active: nativeDefault.colors.TEXT_BRAND, pressed: nativeDefault.colors.TEXT_BRAND };
let closure_11 = createStyles.createStyleProperties({ inactive: nativeDefault.colors.TEXT_MUTED, active: nativeDefault.colors.TEXT_STRONG, pressed: nativeDefault.colors.TEXT_STRONG });
const __initData = { 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')};}" };
const __initData2 = { 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)}]};}" };
const __initData3 = { code: "function TabItemNativeTsx3(){const{activeIndex,index}=this.__closure;return{accessibilityState:{selected:activeIndex.get()===index}};}" };
const size = fn(2);
let result = size.fileFinishedImporting("design/components/Tabs/native/TabItem.native.tsx");
export const TabItem = function TabItem(arg0) {
({ count, index } = arg0);
({ state, pressed, variant } = arg0);
({ label, itemCount, grow } = arg0);
const merged = Object.assign(arg0, Object.assign({ label: 0, count: 0, index: 0, itemCount: 0, state: 0, pressed: 0, grow: 0, variant: 0 }));
const activeIndex = state.activeIndex;
const setItemDimensions = state.setItemDimensions;
let tmp2 = closure_9();
const fn = function f() {
const obj = { accessibilityState: { selected: activeIndex.get() === index } };
return obj;
};
fn.__closure = { activeIndex, index };
fn.__workletHash = 11618929630200;
fn.__initData = __initData3;
closure_129_0 = index;
closure_129_1 = activeIndex;
closure_129_2 = pressed;
closure_129_3 = undefined;
const animatedProps = index(setItemDimensions[3]).useAnimatedProps(fn);
let tmp6 = closure_10();
if ("gradient-background" === variant) {
tmp6 = closure_11();
}
closure_129_3 = tmp6;
let obj = index(setItemDimensions[3]);
const fn2 = function c() {
let active = inactive.inactive;
value = setItemDimensions.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 = setItemDimensions.get() >= 0;
tmp4 = index;
obj.color = spring.withSpring(active, closure_7, "animate-always");
return obj;
};
const tmp3Result = index(setItemDimensions[3]);
fn2.__closure = { colors: tmp6, pressed, index, activeIndex, withSpring: index(setItemDimensions[6]).withSpring, TEXT_SPRING_CONFIG };
fn2.__workletHash = 11643476765161;
fn2.__initData = __initData;
const items = [tmp2.item, ];
let num = 0;
const animatedStyle = tmp3Result.useAnimatedStyle(fn2);
if (grow) {
num = 1;
}
const obj3 = { style: items };
items[1] = { flexGrow: num };
const merged1 = Object.assign(merged);
obj3.onLayout = function onLayout(nativeEvent) {
ReanimatedRexport2.runOnUI(setItemDimensions)(index, nativeEvent.nativeEvent.layout);
};
obj3.accessibilityRole = "tab";
const obj2 = { colors: tmp6, pressed, index, activeIndex, withSpring: index(setItemDimensions[6]).withSpring, TEXT_SPRING_CONFIG };
const tmp8 = closure_5;
const tmp9 = closure_6;
let formatToPlainStringResult;
if (tmp3Result2.isAndroid()) {
const intl = tmp3(tmp4[9]).intl;
const obj4 = { position: index + 1, tabCount: itemCount };
formatToPlainStringResult = intl.formatToPlainString(tmp3(tmp4[9]).t["4EsQA1"], obj4);
}
obj3.accessibilityHint = formatToPlainStringResult;
obj3.animatedProps = animatedProps;
const items1 = [closure_4(index(setItemDimensions[7]).Text, { animated: true, variant: "text-sm/semibold", style: animatedStyle, lineClamp: 1, children: label }), ];
let tmp12Result = null;
if (null != count) {
const obj5 = { count, index, activeIndex, pressed, variant };
tmp12Result = closure_4(TabItemCount, obj5);
}
items1[1] = tmp12Result;
obj3.children = items1;
return tmp8(tmp9, obj3);
};