Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excludeNonJsxCompletions will also exclude forwardRef #212

Open
tjx666 opened this issue Jun 25, 2024 · 4 comments
Open

excludeNonJsxCompletions will also exclude forwardRef #212

tjx666 opened this issue Jun 25, 2024 · 4 comments

Comments

@tjx666
Copy link

tjx666 commented Jun 25, 2024

for example:

import { forwardRef } from 'react';

import { StyledSvg } from '@/components/styledElements';
import { mergeSx } from '@/utils/style';

import type { IconProps } from './types';

/**
 * @see https://icones.js.org/collection/ph?icon=ph:smiley
 * @see https://api.iconify.design/ph:smiley
 */
const PhSmiley = forwardRef<SVGSVGElement, IconProps>(function PhSmiley(
  { size, color, sx, ...props },
  ref,
) {
  const sizePx = `${size}px`;
  return (
    <StyledSvg
      ref={ref}
      xmlns="http://www.w3.org/2000/svg"
      xmlnsXlink="http://www.w3.org/1999/xlink"
      width="16"
      height="16"
      viewBox="0 0 16 16"
      sx={mergeSx(
        {
          ...(size ? { width: sizePx, height: sizePx, fontSize: sizePx } : {}),
          color,
        },
        sx,
      )}
      {...props}
    >
      <path
        fill="currentColor"
        d="M8 1.5A6.5 6.5 0 1014.5 8 6.507 6.507 0 008 1.5m0 12A5.5 5.5 0 1113.5 8 5.506 5.506 0 018 13.5M5 6.75a.75.75 0 11.75.75.75.75 0 01-.75-.75m6 0a.75.75 0 11-.75-.75.75.75 0 01.75.75m-.067 3C10.29 10.862 9.221 11.5 8 11.5s-2.29-.637-2.932-1.75a.5.5 0 11.865-.5c.466.807 1.2 1.25 2.067 1.25s1.6-.444 2.067-1.25a.5.5 0 01.866.5"
      />
    </StyledSvg>
  );
});

export default PhSmiley;
@zardoy
Copy link
Owner

zardoy commented Jun 25, 2024

btw forwardRef is deprecated (read react blog/docs), you should not be using it anymore

@tjx666
Copy link
Author

tjx666 commented Jun 25, 2024

I know, but need time to migrate...

@svipas
Copy link

svipas commented Dec 9, 2024

For me it also excludes Text, FlatList, etc. from React Native. It also adds interfaces/types into suggestions (seems like not always, but one time I was able to repro). And, suggests things like textarea, etc. even though I'm in RN project (could check if expo or react-native package installed to skip those maybe?). Otherwise very very useful feature is just that I do see it is experiment for sure.

@zardoy
Copy link
Owner

zardoy commented Dec 9, 2024

Yes, we never tested it with react native afaik, this feature is generally outdated and needs to be updated, but it's kind of complex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants