optimizations
This commit is contained in:
+15
-10
@@ -1,24 +1,26 @@
|
||||
import { ReactNode } from "react";
|
||||
import { View, Text, GestureResponderEvent } from "react-native";
|
||||
import { View, GestureResponderEvent, StyleSheet } from "react-native";
|
||||
import { Button as PaperButton } from "react-native-paper";
|
||||
|
||||
import { colors } from "@/constants/colors";
|
||||
|
||||
interface ButtonProps {
|
||||
buttonColor?: string;
|
||||
buttonMode?: "outlined" | "contained";
|
||||
buttonTextColor?: string;
|
||||
onPress: (event: GestureResponderEvent) => void;
|
||||
disabled: boolean;
|
||||
disabled?: boolean;
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export const Button = ({
|
||||
buttonColor = "#6750a4",
|
||||
buttonColor = colors.primaryPurpleDark,
|
||||
buttonMode = "outlined",
|
||||
buttonTextColor = "white",
|
||||
onPress,
|
||||
disabled,
|
||||
disabled = false,
|
||||
children,
|
||||
className,
|
||||
icon,
|
||||
@@ -33,14 +35,17 @@ export const Button = ({
|
||||
disabled={disabled}
|
||||
textColor={buttonTextColor}
|
||||
icon={icon}
|
||||
style={{ borderRadius: 4, borderColor: "transparent" }}
|
||||
style={styles.buttonStyle}
|
||||
>
|
||||
{typeof children === "string" || typeof children === "number" ? (
|
||||
<Text>{children}</Text>
|
||||
) : (
|
||||
children
|
||||
)}
|
||||
{children}
|
||||
</PaperButton>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
buttonStyle: {
|
||||
borderRadius: 4,
|
||||
borderColor: "transparent",
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user