fix: restore shared workflow and RN class context

This commit is contained in:
copilot-swe-agent[bot]
2026-09-22 08:28:22 +00:00
committed by GitHub
parent ad93b94f14
commit 07314cc57a
3 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Test
run: pnpm --filter lucide-react test
run: pnpm --filter @lucide/shared test
typecheck:
runs-on: ubuntu-latest
+3 -2
View File
@@ -1,6 +1,6 @@
import { createElement, forwardRef, type FunctionComponent } from 'react';
import * as NativeSvg from 'react-native-svg';
import { buildLucideIconForReact, hasA11yProp } from '@lucide/shared';
import { buildLucideIconForReact, hasA11yProp, mergeClasses } from '@lucide/shared';
import { childDefaultAttributes } from './defaultAttributes';
import { LucideIconData, LucideIconNode, LucideProps } from './types';
import { useLucideContext } from './context';
@@ -79,6 +79,7 @@ const Icon = forwardRef<SVGSVGElement, IconComponentProps>(
absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
nonScalingStroke: contextNonScalingStroke = false,
color: contextColor = 'currentColor',
className: contextClass = '',
} = useLucideContext() ?? {};
const hasAccessibleProp = Boolean(children) || hasA11yProp(rest);
@@ -90,7 +91,7 @@ const Icon = forwardRef<SVGSVGElement, IconComponentProps>(
strokeWidth: strokeWidth ?? contextStrokeWidth,
absoluteStrokeWidth: absoluteStrokeWidth ?? contextAbsoluteStrokeWidth,
nonScalingStroke: nonScalingStroke ?? contextNonScalingStroke,
className,
className: mergeClasses(contextClass, className),
hasA11yProp: hasAccessibleProp,
attributes: rest,
});
+6 -1
View File
@@ -9,12 +9,14 @@ const LucideContext = createContext<{
*/
absoluteStrokeWidth?: boolean;
nonScalingStroke?: boolean;
className?: string;
}>({
size: 24,
color: 'currentColor',
strokeWidth: 2,
absoluteStrokeWidth: false,
nonScalingStroke: false,
className: '',
});
interface LucideProviderProps {
@@ -27,6 +29,7 @@ interface LucideProviderProps {
*/
absoluteStrokeWidth?: boolean;
nonScalingStroke?: boolean;
className?: string;
}
export function LucideProvider({
@@ -36,6 +39,7 @@ export function LucideProvider({
strokeWidth,
absoluteStrokeWidth,
nonScalingStroke,
className,
}: LucideProviderProps) {
const value = useMemo(
() => ({
@@ -44,8 +48,9 @@ export function LucideProvider({
strokeWidth,
absoluteStrokeWidth,
nonScalingStroke,
className,
}),
[size, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke],
[size, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className],
);
return createElement(LucideContext.Provider, { value }, children);