Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix css type is different from web #38

Merged
merged 1 commit into from Nov 16, 2022

Conversation

tkow
Copy link
Contributor

@tkow tkow commented Nov 8, 2022

I noticed css type doesn't match styled component css prop. So in this example type error occurs.
スクリーンショット 2022-11-08 14 09 07

This type is css object but, defined as function like component with some merged props, maybe it's copied from stitches for web.
Stitches native's css returns css type generated by createStitches, so I fix the type as it is.

@tkow
Copy link
Contributor Author

tkow commented Nov 8, 2022

For everyone comes here have the trouble. The temporary way works .

// stitches.config.ts
export type StitchesCss = CSS<typeof config>

// other files
import { styled, StitchesCss } from 'path/to/stitches.config'

const View = styled('View', {});

const csstest: StitchesCss = {
  fontSize: 16,
};

export const Test = <View css={csstest} />;

@Temzasse
Copy link
Owner

I think there is some confusion here. The object returned from css() is not supposed to be used with regular react-native components but instead you should use it with stitches-native styled components.

@Temzasse
Copy link
Owner

Default React Native components don't have a css prop so I will close this PR since it's not applicable to this library.

@Temzasse Temzasse closed this Nov 15, 2022
@tkow
Copy link
Contributor Author

tkow commented Nov 16, 2022

@Temzasse
Sorry, the example I suggested is wrong and older than this PR I finished . Even If it's derived from styled of stitches, this type error occurs and I fixed it already in this PR. Could you re-check and open this PR?

スクリーンショット 2022-11-16 10 06 40

@Temzasse Temzasse reopened this Nov 16, 2022
Copy link
Owner

@Temzasse Temzasse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 👍🏻

Sorry for closing this too eagerly 😅

@Temzasse Temzasse merged commit a4c393e into Temzasse:main Nov 16, 2022
@Temzasse
Copy link
Owner

Released in v0.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants