stitches-native icon indicating copy to clipboard operation
stitches-native copied to clipboard

Styled TextInput Ref TypeScript Error

Open ctfdavis opened this issue 3 years ago • 2 comments

When using styled on TextInput to create a styled component, I get a TypeScript error if I pass ref to it (regardless of the actual ref value): image

However, I am able to use the ref just fine after placing @ts-ignore above the StyledTextInput. I believe this is only an issue on the TypeScript side.

It would be nice to see this get fixed. Thanks!

ctfdavis avatar Aug 03 '22 09:08 ctfdavis

Hi! 👋🏻

I'm kindah banging my head against the wall with this one since the TS side of things is mostly copied from the Stitches core and adapted to React Native as much as possible.

I guess a temp fix for this could be to set the ref type to ref?: any in Stitches Native internal typings and hope that some TS wizard comes and fixes the issue for real 😄

Temzasse avatar Aug 21 '22 11:08 Temzasse

Added the above ref?: any temp fix in v0.2.1.

You can still maintain proper type safety with the ref even though the styled component prop is typed as any, so I hope this is an ok fix for now 😄

Screenshot 2022-08-21 at 14 45 31

I'll leave the issue open if someone comes and is able to fix this properly.

Temzasse avatar Aug 21 '22 11:08 Temzasse