22 lines
690 B
TypeScript
22 lines
690 B
TypeScript
|
|
import React from 'react';
|
||
|
|
import { Text, TextStyle } from 'react-native'; // Removed StyleProp
|
||
|
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||
|
|
|
||
|
|
interface AppIconProps {
|
||
|
|
name: string;
|
||
|
|
size?: number;
|
||
|
|
color?: string;
|
||
|
|
style?: TextStyle; // Simplification
|
||
|
|
}
|
||
|
|
|
||
|
|
export const AppIcon: React.FC<AppIconProps> = ({ name, size = 24, color, style }) => {
|
||
|
|
// Check if likely emoji (non-ascii)
|
||
|
|
const isEmoji = /[^\u0000-\u007F]/.test(name);
|
||
|
|
|
||
|
|
if (isEmoji) {
|
||
|
|
return <Text style={[{ fontSize: size, color }, style]}>{name}</Text>;
|
||
|
|
}
|
||
|
|
|
||
|
|
return <MaterialCommunityIcons name={name} size={size} color={color} style={style} />;
|
||
|
|
};
|