diff --git a/components/RoundButton.tsx b/components/RoundButton.tsx index 90d96e3e..49d45cba 100644 --- a/components/RoundButton.tsx +++ b/components/RoundButton.tsx @@ -6,12 +6,15 @@ import { TouchableOpacity, TouchableOpacityProps, } from "react-native"; +import * as Haptics from "expo-haptics"; interface Props extends TouchableOpacityProps { onPress: () => void; icon?: keyof typeof Ionicons.glyphMap; background?: boolean; size?: "default" | "large"; + fillColor?: "primary"; + hapticFeedback?: boolean; } export const RoundButton: React.FC> = ({ @@ -20,15 +23,43 @@ export const RoundButton: React.FC> = ({ onPress, children, size = "default", + fillColor, + hapticFeedback = true, ...props }) => { const buttonSize = size === "large" ? "h-10 w-10" : "h-9 w-9"; + const fillColorClass = fillColor === "primary" ? "bg-purple-600" : ""; + + const handlePress = () => { + if (hapticFeedback) { + Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); + } + onPress(); + }; + + if (fillColor) + return ( + + {icon ? ( + + ) : null} + {children ? children : null} + + ); if (background === false) return ( {icon ? ( @@ -45,8 +76,10 @@ export const RoundButton: React.FC> = ({ if (Platform.OS === "android") return ( {icon ? ( @@ -61,10 +94,10 @@ export const RoundButton: React.FC> = ({ ); return ( - + {icon ? (