aykutkardas / react-icomoon

It makes it very simple to use SVG icons in your React and React-Native projects.
https://svgps.app
MIT License
216 stars 22 forks source link

using with nativewind #42

Open iamhaaamed opened 1 year ago

iamhaaamed commented 1 year ago

Is it possible to use react-icomoon with nativewind? I have used it like this:

import { styled } from 'nativewind';
import * as React from 'react';
import type { IconProps } from 'react-icomoon';
import IcoMoon from 'react-icomoon';
import { Path, Svg } from 'react-native-svg';

import iconSet from './selection.json';

const SIcoMoon = styled(IcoMoon);
export type NTIconProps = IconProps & {
  className?: string;
};

export const Icon = ({ className, style, ...props }: NTIconProps) => {
  return (
    <SIcoMoon
      native
      SvgComponent={Svg}
      PathComponent={Path}
      iconSet={iconSet}
      size={20}
      style={style}
      className={className}
      {...props}
    />
  );
};

but neither class nor style works for react-icomoon. I have used nativewind with react native built-in components and also other components like fast image and it's working but not with react-icomoon.