From 0ea5cbfcc31202156458b93afeaac3058d35b88b Mon Sep 17 00:00:00 2001 From: rajat693 Date: Wed, 18 Sep 2024 15:24:16 +0530 Subject: [PATCH] fix: lucide icon issue --- .../nativewind/accordion/index.tsx | 2 +- .../nativewind/actionsheet/index.tsx | 2 +- .../nativewind/alert/index.tsx | 2 +- .../nativewind/badge/index.tsx | 2 +- .../nativewind/button/index.tsx | 2 +- .../nativewind/checkbox/index.tsx | 2 +- .../core-components/nativewind/fab/index.tsx | 2 +- .../nativewind/form-control/index.tsx | 64 +++++++++++-------- .../nativewind/input/index.tsx | 2 +- .../nativewind/radio/index.tsx | 2 +- .../nativewind/select/index.tsx | 2 +- 11 files changed, 49 insertions(+), 35 deletions(-) diff --git a/example/storybook-nativewind/src/core-components/nativewind/accordion/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/accordion/index.tsx index ca8d35fbf..a0accad23 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/accordion/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/accordion/index.tsx @@ -105,7 +105,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/actionsheet/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/actionsheet/index.tsx index ad40846e0..c98a4497c 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/actionsheet/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/actionsheet/index.tsx @@ -48,7 +48,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/alert/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/alert/index.tsx index cd1d60416..6e63ea9ee 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/alert/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/alert/index.tsx @@ -128,7 +128,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/badge/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/badge/index.tsx index 0130802f4..08935324d 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/badge/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/badge/index.tsx @@ -117,7 +117,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/button/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/button/index.tsx index b0b9b10c7..26faa5535 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/button/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/button/index.tsx @@ -52,7 +52,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/checkbox/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/checkbox/index.tsx index 93300d5bf..7924e2377 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/checkbox/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/checkbox/index.tsx @@ -59,7 +59,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/fab/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/fab/index.tsx index a33387755..6ccdad543 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/fab/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/fab/index.tsx @@ -37,7 +37,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/form-control/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/form-control/index.tsx index fcdf8cc12..951fb6cee 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/form-control/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/form-control/index.tsx @@ -27,32 +27,46 @@ type IPrimitiveIcon = React.ComponentPropsWithoutRef & { const PrimitiveIcon = React.forwardRef< React.ElementRef, IPrimitiveIcon ->(({ height, width, fill, color, size, stroke, as: AsComp, ...props }, ref) => { - const sizeProps = useMemo(() => { - if (size) return { size }; - if (height && width) return { height, width }; - if (height) return { height }; - if (width) return { width }; - return {}; - }, [size, height, width]); - - let colorProps = {}; - if (color) { - colorProps = { ...colorProps, color: color }; - } - if (stroke) { - colorProps = { ...colorProps, stroke: stroke }; - } - if (fill) { - colorProps = { ...colorProps, fill: fill }; - } - if (AsComp) { - return ; +>( + ( + { + height, + width, + fill, + color, + size, + stroke = 'currentColor', + as: AsComp, + ...props + }, + ref + ) => { + const sizeProps = useMemo(() => { + if (size) return { size }; + if (height && width) return { height, width }; + if (height) return { height }; + if (width) return { width }; + return {}; + }, [size, height, width]); + + let colorProps = {}; + if (color) { + colorProps = { ...colorProps, color: color }; + } + if (stroke) { + colorProps = { ...colorProps, stroke: stroke }; + } + if (fill) { + colorProps = { ...colorProps, fill: fill }; + } + if (AsComp) { + return ; + } + return ( + + ); } - return ( - - ); -}); +); const formControlStyle = tva({ base: 'flex flex-col', diff --git a/example/storybook-nativewind/src/core-components/nativewind/input/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/input/index.tsx index 3f5013b5d..3e8d0ad04 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/input/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/input/index.tsx @@ -38,7 +38,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx index 78733932c..b8de59557 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx @@ -58,7 +58,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props }, diff --git a/example/storybook-nativewind/src/core-components/nativewind/select/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/select/index.tsx index 2c6ec85f3..6e600d1ae 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/select/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/select/index.tsx @@ -111,7 +111,7 @@ const PrimitiveIcon = React.forwardRef< color, classNameColor, size, - stroke, + stroke = 'currentColor', as: AsComp, ...props },