mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-12-02 16:49:06 +00:00
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:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user