@uiw/react-native
Version:
UIW for React Native
41 lines (34 loc) • 902 B
JavaScript
import React from 'react';
import Svg, { SvgXml, Path } from 'react-native-svg';
import svgPaths from '@uiw/icons/fonts/w-icon.json';
export default class Icons extends React.Component {
static displayName = 'uiwm.Icon';
static defaultProps = {
size: 26
};
render() {
const {
name,
size,
fill = '#000000',
stroke,
xml,
paths,
color,
...otherProps
} = this.props;
if (xml) {
return <SvgXml xml={xml} height={size} width={size} {...otherProps} />;
}
let pathData = paths;
if (!pathData) {
if (!name || !svgPaths[name]) {
return null;
}
pathData = svgPaths[name];
}
return <Svg fill={color || fill} stroke={stroke} height={size} width={size} viewBox="0 0 20 20" {...otherProps}>
{pathData.map((d, i) => <Path key={i} d={d} fillRule="evenodd" />)}
</Svg>;
}
}