2022-05-02 19:21:15 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
|
2023-10-04 14:50:58 +00:00
|
|
|
import { TextProps } from 'react-native';
|
2022-05-02 19:21:15 +00:00
|
|
|
|
|
|
|
import { mappedIcons } from './mappedIcons';
|
|
|
|
|
|
|
|
const icoMoonConfig = require('./selection.json');
|
|
|
|
|
|
|
|
export const IconSet = createIconSetFromIcoMoon(icoMoonConfig, 'custom', 'custom.ttf');
|
|
|
|
|
|
|
|
export type TIconsName = keyof typeof mappedIcons;
|
|
|
|
|
2022-07-06 13:23:02 +00:00
|
|
|
export interface ICustomIcon extends TextProps {
|
2022-05-02 19:21:15 +00:00
|
|
|
name: TIconsName;
|
|
|
|
size: number;
|
|
|
|
color: string;
|
|
|
|
}
|
|
|
|
|
2023-10-03 20:54:00 +00:00
|
|
|
const CustomIcon = ({ name, size, color, style, ...props }: ICustomIcon) => (
|
2022-05-02 19:21:15 +00:00
|
|
|
// @ts-ignore TODO remove this after update @types/react-native to 0.65.0
|
2023-10-04 14:50:58 +00:00
|
|
|
<IconSet name={name} size={size} color={color} style={[{ lineHeight: size }, style]} {...props} />
|
2022-05-02 19:21:15 +00:00
|
|
|
);
|
|
|
|
export { CustomIcon };
|