import React from 'react';
import { StyleSheet, ViewProps } from 'react-native';
import { Ionicons } from '@expo/vector-icons'; // Or your preferred icon library
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';

type ThemedIconProps = ViewProps & {
  name: string;
  size?: number;
  color?: string;
};

const ThemedIcon: React.FC<ThemedIconProps> = ({ name, size = 24, color, style, ...restProps }) => {
  const scheme = useColorScheme() ?? 'dark';
  const iconColor = color || Colors[scheme].text;

  return <Ionicons name={name} size={size} color={iconColor} style={style} {...restProps} />;
};

export default ThemedIcon;
