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

replace keyof ReactSVG with SVGElementType #2668

Merged
merged 11 commits into from
Jan 18, 2025
8 changes: 1 addition & 7 deletions packages/lucide-react-native/src/createLucideIcon.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
forwardRef,
createElement,
ReactSVG,
FunctionComponent,
ForwardRefExoticComponent,
} from 'react';
import { forwardRef, createElement, FunctionComponent } from 'react';
import * as NativeSvg from 'react-native-svg';
import defaultAttributes, { childDefaultAttributes } from './defaultAttributes';
import { IconNode, LucideIcon, LucideProps } from './types';
Expand Down
19 changes: 17 additions & 2 deletions packages/lucide-react-native/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import type { ForwardRefExoticComponent, ReactSVG } from 'react';
import type { ForwardRefExoticComponent } from 'react';
import type { SvgProps } from 'react-native-svg';

export type IconNode = [elementName: keyof ReactSVG, attrs: Record<string, string>][];
/**
* A reduced version of `SVGElementType` from @types/react. This type was added
* with the release of React 19, and is included here in order to support usage
* with older versions.
*/
type SVGElementType =
| 'circle'
| 'ellipse'
| 'g'
| 'line'
| 'path'
| 'polygon'
| 'polyline'
| 'rect';

export type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][];

aslilac marked this conversation as resolved.
Show resolved Hide resolved
export interface LucideProps extends SvgProps {
size?: string | number;
Expand Down
19 changes: 17 additions & 2 deletions packages/lucide-react/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import { ReactSVG, SVGProps, ForwardRefExoticComponent, RefAttributes } from 'react';
import type { SVGProps, ForwardRefExoticComponent, RefAttributes } from 'react';

export type IconNode = [elementName: keyof ReactSVG, attrs: Record<string, string>][];
/**
* A reduced version of `SVGElementType` from @types/react. This type was added
* with the release of React 19, and is included here in order to support usage
* with older versions.
*/
type SVGElementType =
| 'circle'
| 'ellipse'
| 'g'
| 'line'
| 'path'
| 'polygon'
| 'polyline'
| 'rect';

export type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][];

ericfennis marked this conversation as resolved.
Show resolved Hide resolved
export type SVGAttributes = Partial<SVGProps<SVGSVGElement>>;
type ElementAttributes = RefAttributes<SVGSVGElement> & SVGAttributes;
Expand Down
Loading