Added theme components. Reorganized them. Prepping for Tech Tracker Rewrite
This commit is contained in:
34
components/theme/ui/ThemedIcon.tsx
Normal file
34
components/theme/ui/ThemedIcon.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user