[nobuild] .

This commit is contained in:
Stef-00012 2025-02-07 08:01:03 +01:00
parent 3f586399de
commit aa36fbb91e
No known key found for this signature in database
GPG key ID: 28BE9A9E4EF0E6BF
9 changed files with 809 additions and 718 deletions

View file

@ -4,12 +4,10 @@ import { MaterialIcons } from "@expo/vector-icons";
import { type ColorValue, type DimensionValue, Pressable, Text } from "react-native";
interface Props {
onPress: () => void | Promise<void>;
onPress: () => unknown | Promise<unknown>;
disabled?: boolean;
color: ColorValue;
disabledColor?: ColorValue;
textColor?: ColorValue;
disabledTextColor?: ColorValue;
text?: string;
width?: DimensionValue;
height?: DimensionValue;
@ -17,15 +15,23 @@ interface Props {
iconColor?: ColorValue;
borderWidth?: number;
borderColor?: ColorValue;
iconSize?: number;
padding?: number;
rippleColor?: ColorValue;
margin?: {
top?: DimensionValue;
bottom?: DimensionValue;
left?: DimensionValue;
right?: DimensionValue;
},
flex?: number
}
export default function Button({
onPress = () => {},
disabled = false,
color,
disabledColor,
textColor = "white",
disabledTextColor = "gray",
text,
width,
height,
@ -33,37 +39,45 @@ export default function Button({
iconColor = "white",
borderWidth = 0,
borderColor,
iconSize = 20,
padding = 10,
margin = {},
rippleColor,
flex
}: Props) {
return (
<Pressable
onPress={onPress}
disabled={disabled}
android_ripple={{
color: disabled
? getRippleColor(disabledColor as string || "#323244")
: getRippleColor(color as string),
color: rippleColor || getRippleColor(color as string)
}}
style={{
...styles.button,
width: width,
...(height && { height: height }),
backgroundColor: disabled ? disabledColor : color,
backgroundColor: color,
borderWidth: borderWidth,
borderColor: borderColor,
padding: 10 - borderWidth
padding: padding - borderWidth,
...(margin.left && { marginLeft: margin.left }),
...(margin.right && { marginRight: margin.right }),
...(margin.top && { marginTop: margin.top }),
...(margin.bottom && { marginBottom: margin.bottom }),
...(flex && { flex })
}}
>
{icon && (
<MaterialIcons
name={icon}
size={20}
size={iconSize}
color={iconColor}
/>
)}
{text && (
<Text style={{
...styles.buttonText,
color: disabled ? disabledTextColor : textColor,
color: textColor,
...(icon && { marginLeft: 5 })
}}>{text}</Text>
)}