121 lines
7.4 KiB
TypeScript
121 lines
7.4 KiB
TypeScript
/* Metro module 9222; source: design/components/SegmentedControl/native/SegmentedControlItem.native.tsx; dependencies: [31, 27, 33, 4501, 697, 8621, 4017, 4577, 477, 1244, 4573, 2] */
|
|
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 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 */
|
|
|
|
function _fun72125(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#72125, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9407:6, offset: 0x01d3ac1e, size: 345 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
ReactModule;
|
|
let value = ReactNativeModule;
|
|
const env0_3 = value.Pressable;
|
|
const env0_4 = value.View;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_5 = value.jsx;
|
|
const env0_6 = value.jsxs;
|
|
const env0_7 = {'mass': 0.3, 'damping': 13, 'stiffness': 250, 'overshootClamping': true};
|
|
const env0_8 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(_fun72126);
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyleProperties = value.createStyleProperties;
|
|
object = {};
|
|
const TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
|
|
object.inactive = TEXT_MUTED;
|
|
let INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
|
|
object.active = INTERACTIVE_TEXT_ACTIVE;
|
|
INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
|
|
object.pressed = INTERACTIVE_TEXT_ACTIVE;
|
|
const env0_9 = Reflect.apply(createStyleProperties, value, [object]);
|
|
object = {code: "function SegmentedControlItemNativeTsx1(){const{colors,pressed,index,activeIndex,withSpring,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,SPRING_CONFIG,'animate-always')};}"};
|
|
(FileImportTrackerModule).fileFinishedImporting('design/components/SegmentedControl/native/SegmentedControlItem.native.tsx');
|
|
exports.SegmentedControlItem = SegmentedControlItem;
|
|
function _fun72126(a0) { // fn#72126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9407:246, offset: 0x01d3ad77, size: 108 bytes, params: 2, frame: 14
|
|
const object2 = {};
|
|
const value = 4;
|
|
object2.borderRadius = importDefault(dependencyMap[value]).radii.lg;
|
|
object2.paddingVertical = a0 !== 'experimental_Small' ? 8 : value;
|
|
object2.flexDirection = 'row';
|
|
object2.justifyContent = 'center';
|
|
return {item: object2, label: {'flexDirection': 'column', 'alignItems': 'center', 'gap': 8}};
|
|
}
|
|
|
|
function SegmentedControlItem({label, index, itemCount, icon, state, onPress, onPressIn, onPressOut, pressed, variant, style}) { // fn#72127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9407:1205, offset: 0x01d3ade3, size: 562 bytes, params: 2, frame: 31
|
|
var r4;
|
|
var intl;
|
|
const activeIndex = state.activeIndex;
|
|
const styles = useStyles(variant);
|
|
const value3 = env0_9();
|
|
const value4 = (require(8621) /* metro dependency 8621: useStateFromSharedValue */).useDerivedStateFromSharedValue(activeIndex,
|
|
function(a0) {
|
|
return {selected: a0 === index};
|
|
});
|
|
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
|
|
const SegmentedControlItemB2 = SegmentedControlItemB;
|
|
const object = {colors: value3, pressed: pressed, index: index, activeIndex: activeIndex};
|
|
object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
|
|
object.SPRING_CONFIG = env0_7;
|
|
SegmentedControlItemB2.__closure = object;
|
|
SegmentedControlItemB2.__workletHash = 9369301431547;
|
|
SegmentedControlItemB2.__initData = env0_10;
|
|
const value5 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [SegmentedControlItemB2]);
|
|
const items2 = [styles.item, style];
|
|
if (PlatformUtilsModule.isAndroid()) {
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
r4 = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['4EsQA1'],
|
|
{position: index + 1, tabCount: itemCount});
|
|
} else {
|
|
r4 = undefined;
|
|
}
|
|
const Text = (TextModule).Text;
|
|
return (
|
|
<Pressable
|
|
style={items2}
|
|
onPress={onPress}
|
|
onPressIn={onPressIn}
|
|
onPressOut={onPressOut}
|
|
accessibilityRole="tab"
|
|
accessibilityState={value4}
|
|
accessibilityHint={r4}
|
|
>
|
|
<View style={styles.label}>
|
|
{icon}
|
|
<Text
|
|
animated
|
|
variant="text-sm/semibold"
|
|
style={value5}
|
|
lineClamp={1}
|
|
maxFontSizeMultiplier={variant !== 'experimental_Large' ? undefined : 1.5}
|
|
>
|
|
{label}
|
|
</Text>
|
|
</View>
|
|
</Pressable>
|
|
);
|
|
function SegmentedControlItemB() { // fn#72129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9407:1478, owner: SegmentedControlItem.b, offset: 0x01d3b02c, 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 object = {};
|
|
object.color = (require(4577) /* metro dependency 4577: spring */).withSpring(r5, env1_7, 'animate-always');
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun72125, 9222, [31, 27, 33, 4501, 697, 8621, 4017, 4577, 477, 1244, 4573,
|
|
2]) /* metro module 9222, dependencies: [31, 27, 33, 4501, 697, 8621, 4017, 4577, 477, 1244, 4573, 2] */;
|