Files
discord-decomp/sources/design/components/TableRow/native/TableSwitchRow.native.tsx
T
2026-07-28 01:06:53 +03:00

103 lines
5.8 KiB
TypeScript

/* Metro module 6808; source: design/components/TableRow/native/TableSwitchRow.native.tsx; dependencies: [57, 31, 27, 33, 4501, 477, 3862, 6238, 4573, 6809, 2] */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
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 NativeModule from '../../../utils/native.tsx'; /* Metro dependency 3862 */
import * as TableRowNativeModule from './TableRow.native.tsx'; /* Metro dependency 6238 */
import * as FormSwitchNativeModule from '../../Forms/native/FormSwitch.native.tsx'; /* Metro dependency 6809 */
function _fun53559(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#53559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6986:6, offset: 0x0134ef06, size: 213 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_7 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(function() {
return {labelWithTrailing: {'flexDirection': 'row', 'alignItems': 'center', 'gap': 8}};
});
(FileImportTrackerModule).fileFinishedImporting('design/components/TableRow/native/TableSwitchRow.native.tsx');
exports.TableSwitchRow = TableSwitchRow;
function TableSwitchRow(a0) { // fn#53561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6986:369, offset: 0x0134eff2, size: 699 bytes, params: 2, frame: 39
const value = a0.value;
const env0_1 = a0.onValueChange;
const label = a0.label;
const subLabel = a0.subLabel;
const trailing = a0.trailing;
let disabled = a0.disabled;
const value2 = undefined;
disabled = !(disabled === value2) && disabled;
const accessibilityHint = a0.accessibilityHint;
const variant = a0.variant;
const object = {'value': 0, 'onValueChange': 0, 'label': 0, 'subLabel': 0, 'trailing': 0, 'disabled': 0,
'accessibilityHint': 0, 'variant': 0};
silentSetPrototypeOf(object, null, undefined);
const value4 = copyDataProperties({}, a0, object, variant);
var env0_2Binding = value2;
const closure = function() {
return onValueChange?.(!value);
};
const styles = useStyles();
const isAndroid2 = (PlatformUtilsModule).isAndroid();
const nodeText = (NativeModule).getNodeText(label);
const nodeText2 = (NativeModule).getNodeText(subLabel);
var [property, env0_2] = env0_2Binding(ReactModule.useState(value), 2);
ReactModule.useEffect(_fun53563, [value]);
const TableRow = (TableRowNativeModule).TableRow;
const tableRowProps = {...value4};
tableRowProps['variant'] = variant;
tableRowProps['arrow'] = false;
tableRowProps['label'] = (
trailing == null
? label
: (
<View style={styles.labelWithTrailing}>
{
ReactModule.isValidElement(label)
? label
: ((Text) => <Text variant="text-md/semibold" color={variant !== 'danger' ? 'mobile-text-heading-primary' : 'text-feedback-critical'}>{label}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)
}
{trailing}
</View>
)
);
tableRowProps['subLabel'] = subLabel;
tableRowProps['disabled'] = disabled;
tableRowProps['accessibilityState'] = {disabled: disabled, checked: property};
tableRowProps['accessible'] = true;
tableRowProps['accessibilityRole'] = 'switch';
const value14 = '';
tableRowProps['accessibilityLabel'] = value14 + nodeText + ', ' + (nodeText2 ?? value14);
tableRowProps['accessibilityHint'] = accessibilityHint;
tableRowProps['onPress'] = isAndroid2 ? closure : value2;
tableRowProps['onAccessibilityTap'] = TableSwitchRowOnAccessibilityTap;
const FormSwitch = (FormSwitchNativeModule).FormSwitch;
tableRowProps['trailing'] = (
<FormSwitch
{...{['aria-hidden']: true}}
value={value}
onValueChange={closure}
disabled={disabled}
/>
);
return <TableRow {...tableRowProps} />;
function _fun53563() { // fn#53563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6986:697, offset: 0x00d6a3a0, size: 20 bytes, params: 1, frame: 11
env0_2(value);
}
function TableSwitchRowOnAccessibilityTap() { // fn#53564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6986:1190, owner: TableSwitchRow.onAccessibilityTap, offset: 0x0134f2d3, size: 43 bytes, params: 1, frame: 11
env0_2(!value);
global.setTimeout(function() {
if (onValueChange != null) {
onValueChange(!value);
}
});
}
}
}
global.__d(_fun53559, 6808, [57, 31, 27, 33, 4501, 477, 3862, 6238, 4573, 6809,
2]) /* metro module 6808, dependencies: [57, 31, 27, 33, 4501, 477, 3862, 6238, 4573, 6809, 2] */;