import React from "react"; import { Pressable, StyleSheet, Switch, Text, View, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { moderateScale, scale, verticalScale, } from "react-native-size-matters"; import { Colors } from "@/theme"; interface ProfileMenuItemProps { icon: keyof typeof Ionicons.glyphMap; title: string; subtitle?: string; value?: string | number; onPress?: () => void; showArrow?: boolean; isLast?: boolean; isSwitch?: boolean; switchValue?: boolean; onSwitchChange?: (value: boolean) => void; } export default function ProfileMenuItem({ icon, title, subtitle, value, onPress, showArrow = true, isLast = false, isSwitch = false, switchValue = false, onSwitchChange, }: ProfileMenuItemProps) { const handlePress = () => { if (isSwitch && onSwitchChange) { onSwitchChange(!switchValue); } else if (onPress) { onPress(); } }; return ( [ styles.container, !isLast && styles.border, pressed && !isSwitch && styles.pressed, ]} > {title} {!!subtitle && ( {subtitle} )} {value !== undefined && !isSwitch && ( {value} )} {isSwitch ? ( ) : showArrow ? ( ) : null} ); } const styles = StyleSheet.create({ container: { minHeight: verticalScale(54), flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingHorizontal: scale(16), backgroundColor: "#FFFFFF", }, border: { borderBottomWidth: 1, borderBottomColor: "#F1F3F5", }, leftSection: { flex: 1, flexDirection: "row", alignItems: "center", marginRight: scale(12), }, iconContainer: { width: scale(28), justifyContent: "center", alignItems: "center", marginRight: scale(10), }, textContainer: { flex: 1, justifyContent: "center", }, title: { fontSize: moderateScale(14), fontWeight: "500", color: Colors.text, }, subtitle: { fontSize: moderateScale(11), color: "#94A3B8", marginTop: verticalScale(2), }, rightSection: { flexDirection: "row", alignItems: "center", }, value: { marginRight: scale(6), fontSize: moderateScale(13), color: "#6B7280", fontWeight: "500", }, pressed: { backgroundColor: "#F8F9FA", }, });