189 lines
12 KiB
TypeScript
189 lines
12 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] */
|
|
import ReanimatedRexport from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as PlatformUtilsModule from '../../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as ReanimatedRexportModule from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import * as TextModule from '../../Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as SpringModule from '../../../animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */
|
|
|
|
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
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Pressable = (ReactNativeModule).Pressable;
|
|
let value = JsxRuntimeModule;
|
|
const env0_4 = value.jsx;
|
|
const env0_5 = value.jsxs;
|
|
const env0_6 = (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;
|
|
object = {};
|
|
let TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
|
|
object.inactive = TEXT_MUTED;
|
|
let TEXT_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_BRAND;
|
|
object.active = TEXT_BRAND;
|
|
TEXT_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_BRAND;
|
|
object.pressed = TEXT_BRAND;
|
|
const env0_10 = Reflect.apply(createStyleProperties, value, [object]);
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
createStyleProperties = value.createStyleProperties;
|
|
object = {};
|
|
TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
|
|
object.inactive = TEXT_MUTED;
|
|
let TEXT_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_STRONG;
|
|
object.active = TEXT_STRONG;
|
|
TEXT_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_STRONG;
|
|
object.pressed = TEXT_STRONG;
|
|
const env0_11 = Reflect.apply(createStyleProperties, value, [object]);
|
|
object = {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')};}"};
|
|
object = {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)}]};}'};
|
|
object = {code: 'function TabItemNativeTsx3(){const{activeIndex,index}=this.__closure;return{accessibilityState:{selected:activeIndex.get()===index}};}'};
|
|
(FileImportTrackerModule).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 useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
|
|
const useAnimatedTextStyleC2 = useAnimatedTextStyleC;
|
|
const object = {colors: r11, pressed: pressed, index: index, activeIndex: activeIndex};
|
|
object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
|
|
object.TEXT_SPRING_CONFIG = env0_7;
|
|
useAnimatedTextStyleC2.__closure = object;
|
|
useAnimatedTextStyleC2.__workletHash = 11643476765161;
|
|
useAnimatedTextStyleC2.__initData = env0_12;
|
|
return Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [useAnimatedTextStyleC2]);
|
|
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 = ReactModule.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 ? ReactModule.pressed : value3 ? ReactModule.inactive : Reflect.apply(round, Math,
|
|
[Reflect.apply(get, activeIndexBinding, [])]) !== indexBinding ? inactive : ReactModule.active;
|
|
const object = {};
|
|
object.color = (require(4577) /* metro dependency 4577: spring */).withSpring(r5, env1_7, 'animate-always');
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
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 = (ReanimatedRexportModule).useSharedValue(0);
|
|
ReactModule.useLayoutEffect(_fun69078, [value2]);
|
|
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
|
|
const TabItemCountT2 = TabItemCountT;
|
|
TabItemCountT2.__closure = {withSpring: (require(4577) /* metro dependency 4577: spring */).withSpring,
|
|
countAnimationState: value2, COUNT_SPRING_CONFIG: env0_8, interpolate: ReanimatedRexportModule.interpolate};
|
|
TabItemCountT2.__workletHash = 16666672974627;
|
|
TabItemCountT2.__initData = env0_13;
|
|
const value3 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [TabItemCountT2]);
|
|
const value4 = useAnimatedTextStyle({index: index, activeIndex: activeIndex, pressed: pressed, variant: variant});
|
|
const View = (ReanimatedRexport).View;
|
|
const items2 = [styles.count, value3];
|
|
const Text = (TextModule).Text;
|
|
return (
|
|
<View style={items2}>
|
|
<Text
|
|
animated
|
|
variant="text-sm/medium"
|
|
style={value4}
|
|
lineClamp={1}
|
|
>
|
|
{count}
|
|
</Text>
|
|
</View>
|
|
);
|
|
function _fun69078() { // fn#69078, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9045:2153, offset: 0x01c2f741, size: 24 bytes, params: 1, frame: 11
|
|
env0_0.set(1);
|
|
}
|
|
|
|
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 object = {};
|
|
let withSpring = SpringModule.withSpring;
|
|
const binding = env0_0;
|
|
object.opacity = Reflect.apply(withSpring, SpringModule, [binding.get(), env1_8]);
|
|
const object2 = {};
|
|
withSpring = SpringModule.withSpring;
|
|
object2.translateX = Reflect.apply(withSpring, SpringModule, [ReanimatedRexportModule.interpolate(binding.get(), [0,
|
|
1], [-10, 0]), env1_8]);
|
|
object.transform = [object2];
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
const object = {'label': 0, 'count': 0, 'index': 0, 'itemCount': 0, 'state': 0, 'pressed': 0, 'grow': 0,
|
|
'variant': 0};
|
|
const value = null;
|
|
silentSetPrototypeOf(object, value, undefined);
|
|
const value2 = copyDataProperties({}, a0, object, grow);
|
|
const activeIndex = state.activeIndex;
|
|
const env0_2 = state.setItemDimensions;
|
|
const value4 = undefined;
|
|
const styles = useStyles();
|
|
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';
|
|
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 = (TextModule).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 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);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun69074, 8860, [31, 27, 33, 4017, 4501, 697, 4577, 4573, 477, 1244,
|
|
2]) /* metro module 8860, dependencies: [31, 27, 33, 4017, 4501, 697, 4577, 4573, 477, 1244, 2] */;
|