Files
discord-decomp/_bundle/Button.jsx
T
2026-11-01 12:12:55 +02:00

89 lines
3.2 KiB
React

// Metro module 290 (f291).
import TouchableNativeFeedback from "./TouchableNativeFeedback";
import Module38 from "./Module38";
import View from "./View";
import TextImpl from "./TextImpl";
import Module254 from "./Module254";
let styles;
const Button = (props) => {
const { ref, ...rest } = props;
const { accessibilityLabel, accessibilityState } = rest;
let busy = rest["aria-busy"];
let checked = rest["aria-checked"];
let disabled = rest["aria-disabled"];
let expanded = rest["aria-expanded"];
let accessibilityLabel2 = rest["aria-label"];
let selected = rest["aria-selected"];
const { importantForAccessibility, color, onPress, touchSoundDisabled, title, hasTVPreferredFocus, nextFocusDown, nextFocusForward, nextFocusLeft, nextFocusRight, nextFocusUp, testID, accessible, accessibilityActions, accessibilityHint, accessibilityLanguage, onAccessibilityAction } = rest;
const style2 = [styles.button];
const style = [styles.text];
if (color) {
style2.push({
backgroundColor: color
});
}
if (busy == null) {
busy = accessibilityState?.busy;
}
if (checked == null) {
checked = accessibilityState?.checked;
}
if (disabled == null) {
disabled = accessibilityState?.disabled;
}
if (expanded == null) {
expanded = accessibilityState?.expanded;
}
if (selected == null) {
selected = accessibilityState?.selected;
}
const r43 = {
busy,
checked,
disabled,
expanded,
selected
};
const disabled2 = rest.disabled != null ? rest.disabled : r43.disabled;
const accessibilityState2 = disabled2 !== r43.disabled ? {
...r43,
disabled: disabled2
} : r43;
if (disabled2) {
style2.push(styles.buttonDisabled);
style.push(styles.textDisabled);
}
Module38(typeof title === "string", "The title prop of a Button must be a string");
const r75 = title.toUpperCase();
if (!accessibilityLabel2) {
accessibilityLabel2 = accessibilityLabel;
}
return <TouchableNativeFeedback accessible={accessible} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} accessibilityLabel={accessibilityLabel2} accessibilityHint={accessibilityHint} accessibilityLanguage={accessibilityLanguage} accessibilityRole="button" accessibilityState={accessibilityState2} importantForAccessibility={importantForAccessibility !== "no" ? importantForAccessibility : "no-hide-descendants"} hasTVPreferredFocus={hasTVPreferredFocus} nextFocusDown={nextFocusDown} nextFocusForward={nextFocusForward} nextFocusLeft={nextFocusLeft} nextFocusRight={nextFocusRight} nextFocusUp={nextFocusUp} testID={testID} disabled={disabled2} onPress={onPress} touchSoundDisabled={touchSoundDisabled} ref={ref}>
<View style={style2}>
<TextImpl style={style} disabled={disabled2}>{r75}</TextImpl>
</View>
</TouchableNativeFeedback>;
};
Button.displayName = "Button";
styles = Module254.create({
button: {
elevation: 4,
backgroundColor: "#2196F3",
borderRadius: 2
},
text: {
textAlign: "center",
margin: 8,
color: "white",
fontWeight: "500"
},
buttonDisabled: {
elevation: 0,
backgroundColor: "#dfdfdf"
},
textDisabled: {
color: "#a1a1a1"
}
});
export default Button;