Allow string size and strokeWidth in the icon context

Copilot's PR comment correctly surfaced a gap in the PR - the same type
bug exists in the lucide-react-native project and wasn't fixed there.

Same narrowing as the other framework contexts: `LucideProps` accepts
`size?: string | number`, and `strokeWidth` resolves to react-native-svg's
`NumberProp` (`string | number`), but the context and `LucideProviderProps`
declared both as `number`. `Icon.ts` passes the context value straight through
— `width: width ?? size ?? contextSize` — so nothing downstream needs a number.
This commit is contained in:
Ken Kunz 2026-09-16 09:45:04 -05:00
parent f184b7121d
commit 69d2476af3

View file

@ -1,9 +1,9 @@
import { createContext, createElement, type ReactNode, useContext, useMemo } from 'react';
const LucideContext = createContext<{
size?: number;
size?: number | string;
color?: string;
strokeWidth?: number;
strokeWidth?: number | string;
/**
* @deprecated Use `nonScalingStroke` instead.
*/
@ -19,9 +19,9 @@ const LucideContext = createContext<{
interface LucideProviderProps {
children: ReactNode;
size?: number;
size?: number | string;
color?: string;
strokeWidth?: number;
strokeWidth?: number | string;
/**
* @deprecated Use `nonScalingStroke` instead.
*/