Skip to content

Commit

Permalink
fix: fixes #47 add support for aria label
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkpatchaa committed Aug 14, 2024
1 parent f83c372 commit d3ae8da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions generator/generate-svg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const options = {
icon: true,
native: true,
typescript: true,
titleProp: true,
replaceAttrValues: { '#000': '{props.color}' },
svgProps: {
width: '{props.size}',
Expand Down Expand Up @@ -137,7 +138,7 @@ import light from '../light/${componentFileName}'
import regular from '../regular/${componentFileName}'
import thin from '../thin/${componentFileName}'
function ${componentName}({ weight, color, size, style, mirrored, testID }: IconProps) {
function ${componentName}({ weight, color, size, style, mirrored, ...props }: IconProps) {
const {
color: contextColor = '#000',
size: contextSize = 24,
Expand Down Expand Up @@ -176,7 +177,7 @@ function ${componentName}({ weight, color, size, style, mirrored, testID }: Icon
}),
},
]}
testID={testID ?? 'phosphor-react-native-${icon}-' + weight}
{...props}
/>
)
}
Expand Down
9 changes: 7 additions & 2 deletions src/lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ export type IconWeight =

export type PaintFunction = (color: string) => React.ReactNode | null;

export interface IconProps {
interface SVGRProps {
title?: string;
titleId?: string;
}

export type IconProps = {
color?: string;
size?: string | number;
weight?: IconWeight;
style?: StyleProp<ViewStyle>;
mirrored?: boolean;
testID?: string;
}
} & SVGRProps;

export type Icon = React.FC<IconProps>;

Expand Down

0 comments on commit d3ae8da

Please sign in to comment.