From e5cc0745d23636aa8f228a9af2efd23438d49fb2 Mon Sep 17 00:00:00 2001 From: Viraj Ajay Joshi Date: Wed, 3 Apr 2024 13:40:49 +0530 Subject: [PATCH 1/3] fix: link component --- .../src/core-components/nativewind/link/index.tsx | 2 +- example/storybook-nativewind/tsconfig.json | 1 + packages/unstyled/link/src/types.ts | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/example/storybook-nativewind/src/core-components/nativewind/link/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/link/index.tsx index 811e6fa9c8..c52d8b390e 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/link/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/link/index.tsx @@ -12,7 +12,6 @@ import type { VariantProps } from '@gluestack-ui/nativewind-utils'; import React from 'react'; export const UILink = createLink({ - // @ts-ignore Root: Platform.OS === 'web' ? withStyleContext(Pressable) @@ -47,6 +46,7 @@ const Link = React.forwardRef( type ILinkTextProps = React.ComponentProps & VariantProps; + const LinkText = React.forwardRef( ( { className, ...props }: { className?: string } & ILinkTextProps, diff --git a/example/storybook-nativewind/tsconfig.json b/example/storybook-nativewind/tsconfig.json index f0806f39bf..5d17482b70 100644 --- a/example/storybook-nativewind/tsconfig.json +++ b/example/storybook-nativewind/tsconfig.json @@ -13,6 +13,7 @@ "../../packages/unstyled/alert-dialog/src" ], "@gluestack-ui/menu": ["../../packages/unstyled/menu/src"], + "@gluestack-ui/link": ["../../packages/unstyled/link/src"], "@gluestack-ui/nativewind-utils/tva": [ "../../packages/nativewind/utils/src/tva" ], diff --git a/packages/unstyled/link/src/types.ts b/packages/unstyled/link/src/types.ts index b158069468..b91144442e 100644 --- a/packages/unstyled/link/src/types.ts +++ b/packages/unstyled/link/src/types.ts @@ -1,4 +1,5 @@ import type { MutableRefObject } from 'react'; +import React from 'react'; import type { GestureResponderEvent, ViewProps } from 'react-native'; export interface InterfaceLinkProps extends ViewProps { @@ -29,5 +30,7 @@ export type IUseLinkProp = { export type ILinkComponentType = React.ForwardRefExoticComponent & { - Text: React.ForwardRefExoticComponent; + Text: React.ForwardRefExoticComponent< + TextProps & React.RefAttributes + >; }; From 4f0b3b8b34e7e8ec398baf9265db1c2dbd8b0b77 Mon Sep 17 00:00:00 2001 From: Viraj Ajay Joshi Date: Wed, 3 Apr 2024 13:42:40 +0530 Subject: [PATCH 2/3] fix: slider component --- .../src/core-components/nativewind/slider/index.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/example/storybook-nativewind/src/core-components/nativewind/slider/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/slider/index.tsx index a9e2ad71ae..80fdd7dd9f 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/slider/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/slider/index.tsx @@ -14,7 +14,6 @@ import { withStates } from '@gluestack-ui/nativewind-utils/withStates'; const SCOPE = 'SLIDER'; export const UISlider = createSlider({ - // @ts-ignore Root: Platform.OS === 'web' ? withStyleContext(View, SCOPE) @@ -25,7 +24,6 @@ export const UISlider = createSlider({ ThumbInteraction: View, }); -//@ts-ignore cssInterop(UISlider, { className: 'style' }); cssInterop(UISlider.Thumb, { className: 'style' }); cssInterop(UISlider.Track, { className: 'style' }); @@ -163,7 +161,7 @@ export const Slider = React.forwardRef( isReversed = false, ...props }: any, - ref + ref?: any ) => { return ( { + ({ className, size, ...props }: any, ref?: any) => { const { size: parentSize } = useStyleContext(SCOPE); return ( @@ -203,7 +201,7 @@ export const SliderThumb = React.forwardRef( ); export const SliderTrack = React.forwardRef( - ({ className, ...props }: any, ref) => { + ({ className, ...props }: any, ref?: any) => { const { orientation: parentOrientation, size: parentSize, @@ -228,7 +226,7 @@ export const SliderTrack = React.forwardRef( ); export const SliderFilledTrack = React.forwardRef( - ({ className, ...props }: any, ref) => { + ({ className, ...props }: any, ref?: any) => { const { orientation: parentOrientation } = useStyleContext(SCOPE); return ( From c89401357d9818997e9ebdb7e2797589d17037dc Mon Sep 17 00:00:00 2001 From: Viraj Ajay Joshi Date: Wed, 3 Apr 2024 14:42:59 +0530 Subject: [PATCH 3/3] fix: textarea component --- .../src/core-components/nativewind/switch/index.tsx | 2 +- .../src/core-components/nativewind/textarea/index.tsx | 11 ++++++++--- example/storybook-nativewind/tsconfig.json | 1 + packages/unstyled/textarea/src/types.ts | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/example/storybook-nativewind/src/core-components/nativewind/switch/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/switch/index.tsx index 86c2024fa5..59aa185df9 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/switch/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/switch/index.tsx @@ -34,7 +34,7 @@ type ISwitchProps = React.ComponentProps & const Switch = React.forwardRef( ( { className, size = 'md', ...props }: { className?: string } & ISwitchProps, - ref + ref?: any ) => { return ( { return ( & const TextareaInput = React.forwardRef( ( { className, ...props }: { className?: string } & ITextareaInputProps, - ref + ref?: any ) => { const { size: parentSize } = useStyleContext(SCOPE); diff --git a/example/storybook-nativewind/tsconfig.json b/example/storybook-nativewind/tsconfig.json index 5d17482b70..b4d887d14f 100644 --- a/example/storybook-nativewind/tsconfig.json +++ b/example/storybook-nativewind/tsconfig.json @@ -13,6 +13,7 @@ "../../packages/unstyled/alert-dialog/src" ], "@gluestack-ui/menu": ["../../packages/unstyled/menu/src"], + "@gluestack-ui/textarea": ["../../packages/unstyled/textarea/src"], "@gluestack-ui/link": ["../../packages/unstyled/link/src"], "@gluestack-ui/nativewind-utils/tva": [ "../../packages/nativewind/utils/src/tva" diff --git a/packages/unstyled/textarea/src/types.ts b/packages/unstyled/textarea/src/types.ts index 035f75049e..7a0408336d 100644 --- a/packages/unstyled/textarea/src/types.ts +++ b/packages/unstyled/textarea/src/types.ts @@ -43,5 +43,7 @@ export interface IInputProps { export type ITextareaComponentType = React.ForwardRefExoticComponent & { - Input: React.ForwardRefExoticComponent; + Input: React.ForwardRefExoticComponent< + Input & React.RefAttributes & IInputProps + >; };