import React from "react"; import { TouchableOpacity, TouchableOpacityProps, View } from "react-native"; import CustomText from "./Text"; import { AntDesign } from "@expo/vector-icons"; import { AntDesignIconNames } from "../Icons"; import { Size } from "../Constants"; export type ButtonStyle = "default" | "outline" | "secondary"; //@ts-ignore interface Props extends TouchableOpacityProps { size?: Size; style?: ButtonStyle; insideClassName?: string; beforeIcon?: AntDesignIconNames; afterIcon?: AntDesignIconNames; } export default React.forwardRef( (props, ref): React.ReactElement => { const { size, style, beforeIcon, afterIcon, onPress, className, insideClassName, children, ...rest } = props; const getButtonStyle = (): string => { switch (style ?? "default") { case "default": return ( "justify-center items-center bg-black text-white rounded-3xl" + " " + className ); case "outline": return ( "justify-center items-center border-black text-black border-2 rounded-3xl" + " " + className ); case "secondary": return ( "justify-center items-center bg-gray-200 text-black rounded-3xl" + " " + className ); } }; const getIconSize = (): number => { switch (size ?? "lg") { case "xs": return 24; case "md": return 24; case "lg": return 24; case "xl": return 24; case "2xl": return 30; case "3xl": return 36; } }; return ( {beforeIcon != null ? ( ) : null} {children} {afterIcon != null ? ( ) : null} ); } );