Files
discord-decomp/sources/design/components/Tabs/native/TabItem.native.tsx
T
2026-07-27 16:20:00 +03:00

182 lines
11 KiB
TypeScript

/* Metro module 8860; source: design/components/Tabs/native/TabItem.native.tsx; dependencies: [31, 27, 33, 4017, 4501, 697, 4577, 4573, 477, 1244, 2] */
function _fun69074(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69074, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:6, offset: 0x01c675c8, size: 579 bytes, params: 8, frame: 23
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
const Pressable = (require(27) /* metro dependency 27 */).Pressable;
let value = require(33) /* metro dependency 33 */;
const env0_4 = value.jsx;
const env0_5 = value.jsxs;
const env0_6 = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).createAnimatedComponent(Pressable);
const env0_7 = {'mass': 0.3, 'damping': 13, 'stiffness': 250, 'overshootClamping': true};
const env0_8 = {'mass': 2, 'damping': 30, 'stiffness': 300, 'overshootClamping': true};
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
const env0_9 = Reflect.apply(createStyles, value, [{item: {'flexShrink': 0, 'flexBasis': 0, 'paddingBottom': 14,
'flexDirection': 'row', 'justifyContent': 'center'}, count: {marginLeft: PX_8}}]);
value = require(4501) /* metro dependency 4501: createStyles */;
let createStyleProperties = value.createStyleProperties;
object2 = {};
let TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
object2.inactive = TEXT_MUTED;
let TEXT_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_BRAND;
object2.active = TEXT_BRAND;
TEXT_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_BRAND;
object2.pressed = TEXT_BRAND;
const env0_10 = Reflect.apply(createStyleProperties, value, [object2]);
value = require(4501) /* metro dependency 4501: createStyles */;
createStyleProperties = value.createStyleProperties;
object2 = {};
TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
object2.inactive = TEXT_MUTED;
let TEXT_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_STRONG;
object2.active = TEXT_STRONG;
TEXT_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_STRONG;
object2.pressed = TEXT_STRONG;
const env0_11 = Reflect.apply(createStyleProperties, value, [object2]);
object2 = {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')};}"};
object2 = {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)}]};}'};
object2 = {code: 'function TabItemNativeTsx3(){const{activeIndex,index}=this.__closure;return{accessibilityState:{selected:activeIndex.get()===index}};}'};
(require(2) /* metro dependency 2 */).fileFinishedImporting('design/components/Tabs/native/TabItem.native.tsx');
exports.TabItem = TabItem;
}
function useAnimatedTextStyle({index, activeIndex, pressed, variant}) { // fn#69075, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:1208, offset: 0x01c6780b, size: 205 bytes, params: 2, frame: 20
const r11 = variant !== 'gradient-background' ? env0_10() : env0_11();
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
const closure = useAnimatedTextStyleC;
const object2 = {colors: r11, pressed: pressed, index: index, activeIndex: activeIndex};
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object2.TEXT_SPRING_CONFIG = env0_7;
closure.__closure = object2;
closure.__workletHash = 11643476765161;
closure.__initData = env0_12;
return Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure]);
}
function TabItemCount({count, index, activeIndex, pressed, variant}) { // fn#69077, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:2021, offset: 0x01c67988, size: 370 bytes, params: 2, frame: 26
const styles = useStyles();
const value2 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(0);
env0_3.useLayoutEffect(_fun69078, [value2]);
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
const closure = TabItemCountT;
closure.__closure = {withSpring: (require(4577) /* metro dependency 4577: spring */).withSpring,
countAnimationState: value2, COUNT_SPRING_CONFIG: env0_8, interpolate: reanimatedRexportModule.interpolate};
closure.__workletHash = 16666672974627;
closure.__initData = env0_13;
const value3 = Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure]);
const value4 = useAnimatedTextStyle({index: index, activeIndex: activeIndex, pressed: pressed, variant: variant});
const View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const items2 = [styles.count, value3];
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
<View style={items2}>
<Text
animated
variant="text-sm/medium"
style={value4}
lineClamp={1}
>
{count}
</Text>
</View>
);
}
function TabItem(a0) { // fn#69080, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:2964, offset: 0x01c67ba5, size: 579 bytes, params: 2, frame: 31
var r8;
var intl;
const label = a0.label;
const count = a0.count;
const index = a0.index;
const itemCount = a0.itemCount;
const state = a0.state;
const pressed = a0.pressed;
const grow = a0.grow;
const variant = a0.variant;
let object2 = {'label': 0, 'count': 0, 'index': 0, 'itemCount': 0, 'state': 0, 'pressed': 0, 'grow': 0,
'variant': 0};
const value = null;
silentSetPrototypeOf(object2, value, undefined);
const value2 = copyDataProperties({}, a0, object2, grow);
const activeIndex = state.activeIndex;
const env0_2 = state.setItemDimensions;
const value4 = undefined;
const styles = useStyles();
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedProps = reanimatedRexportModule.useAnimatedProps;
const closure = function() {
var object2 = {};
object2.selected = activeIndex.get() === index;
return {accessibilityState: object2};
};
closure.__closure = {activeIndex: activeIndex, index: index};
closure.__workletHash = 11618929630200;
closure.__initData = env0_14;
const value5 = Reflect.apply(useAnimatedProps, reanimatedRexportModule, [closure]);
const value6 = useAnimatedTextStyle({index: index, activeIndex: activeIndex, pressed: pressed, variant: variant});
const binding = env0_6;
const bindingProps = {style: [styles.item, {flexGrow: grow ? 1 : 0}], ...value2};
bindingProps['onLayout'] = TabItemOnLayout;
bindingProps['accessibilityRole'] = 'tab';
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
if (platformUtilsModule.isAndroid()) {
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
r8 = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['4EsQA1'],
{position: index + 1, tabCount: itemCount});
} else {
r8 = value4;
}
bindingProps['accessibilityHint'] = r8;
bindingProps['animatedProps'] = value5;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return ((Component) => <Component {...bindingProps}><Text animated variant="text-sm/semibold" style={value6} lineClamp={1}>{label}</Text>{value != count ? <TabItemCount count={count} index={index} activeIndex={activeIndex} pressed={pressed} variant={variant} /> : value}</Component>)(binding);
}
function useAnimatedTextStyleC() { // fn#69076, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:1369, owner: useAnimatedTextStyle.c, offset: 0x01c678d8, size: 176 bytes, params: 1, frame: 19
const inactive = env0_3.inactive;
const pressedBinding = pressed;
let get = pressedBinding.get;
const value3 = Reflect.apply(get, pressedBinding, []) >= 0;
const value4 = pressedBinding.get();
const indexBinding = index;
const Math = global.Math;
const round = Math.round;
const activeIndexBinding = activeIndex;
get = activeIndexBinding.get;
const r5 = value4 === indexBinding ? env0_3.pressed : value3 ? env0_3.inactive : Reflect.apply(round, Math,
[Reflect.apply(get, activeIndexBinding, [])]) !== indexBinding ? inactive : env0_3.active;
const object2 = {};
object2.color = (require(4577) /* metro dependency 4577: spring */).withSpring(r5, env1_7, 'animate-always');
return object2;
}
function TabItemCountT() { // fn#69079, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:2211, owner: TabItemCount.T, offset: 0x01c67afa, size: 171 bytes, params: 1, frame: 21
const object3 = {};
const springModule = require(4577) /* metro dependency 4577: spring */;
let withSpring = springModule.withSpring;
const binding = env0_0;
object3.opacity = Reflect.apply(withSpring, springModule, [binding.get(), env1_8]);
const object4 = {};
const moduleValue2 = springModule;
withSpring = moduleValue2.withSpring;
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
object4.translateX = Reflect.apply(withSpring, moduleValue2, [reanimatedRexportModule.interpolate(binding.get(), [0,
1], [-10, 0]), env1_8]);
object3.transform = [object4];
return object3;
}
function TabItemOnLayout({nativeEvent}) { // fn#69082, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:3413, owner: TabItem.onLayout, offset: 0x01c67e10, size: 70 bytes, params: 2, frame: 14
let value = environment.__proto__;
value = Reflect.apply((require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnUI, value,
[setItemDimensions]);
value(index, nativeEvent.layout);
}