Skip to content

Commit cad506e

Browse files
committed
fix icon rendering with context
1 parent a19bf93 commit cad506e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/@react-spectrum/s2/src/Icon.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,17 @@ export function createIcon(Component: ComponentType<SVGProps<SVGSVGElement>>, co
8989
let ctx;
9090
// TODO: remove this default once we release RAC and use DEFAULT_SLOT.
9191
[ctx, ref] = useSpectrumContextProps({slot: props.slot || 'icon'} as IconContextValue, ref, context);
92-
let {render, styles: ctxStyles} = ctx;
92+
let {styles: ctxStyles} = ctx;
9393
let {
9494
UNSAFE_className,
9595
UNSAFE_style,
9696
slot,
9797
'aria-label': ariaLabel,
9898
'aria-hidden': ariaHidden,
9999
styles,
100+
// props are already merged with context via rac's useContextProps in generateS2IconIndex
101+
// @ts-ignore
102+
render,
100103
...otherProps
101104
} = props;
102105

@@ -142,7 +145,7 @@ export function createIllustration(Component: ComponentType<SVGProps<SVGSVGEleme
142145
let ref = useRef<SVGElement>(null);
143146
let ctx;
144147
[ctx, ref] = useSpectrumContextProps({slot: props.slot || 'icon'} as IconContextValue, ref, IllustrationContext);
145-
let {render, styles: ctxStyles} = ctx;
148+
let {styles: ctxStyles} = ctx;
146149
let {
147150
UNSAFE_className,
148151
UNSAFE_style,
@@ -151,6 +154,9 @@ export function createIllustration(Component: ComponentType<SVGProps<SVGSVGEleme
151154
'aria-hidden': ariaHidden,
152155
size = ctx.size || 'M',
153156
styles,
157+
// props are already merged with context via rac's useContextProps in generateS2IconIndex
158+
// @ts-ignore
159+
render,
154160
...otherProps
155161
} = props;
156162

0 commit comments

Comments
 (0)