Support breakpoints in createUnistyles #63
Closed
HellYeahOmg
started this conversation in
Feature Requests
Replies: 1 comment 4 replies
-
Could you show me a more extensive example? I didn't quite understand that. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I'm creating a new theme and want to add some breakpoints, just like using create createStyleSheet:
export const theme = { components: { typography: { h1: { fontFamily: Platform.OS === 'web' ? 'inherit' : 'Mulish_700Bold', fontSize: { xs: 32, xl: 42, }, fontWeight: '700', lineHeight: { xs: 40, xl: 52, }, }, }, }, } as const
ATM it's not working:
![Screenshot 2023-11-07 at 14 00 18](https://private-user-images.githubusercontent.com/29250449/281045611-de4af7c5-8c98-41db-b034-a3dcd2fb3898.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTAwMzksIm5iZiI6MTczOTA0OTczOSwicGF0aCI6Ii8yOTI1MDQ0OS8yODEwNDU2MTEtZGU0YWY3YzUtOGM5OC00MWRiLWIwMzQtYTNkY2QyZmIzODk4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIxMjIxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3NWE0ZWE5OWFmODc4YjY5YTllNDFjNjQ0YWJhZjk0MDYxMTYyNzk2MzgyZGYxYzlkZDljZjViZTI0ZDhlZTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KuZg6dEnnevs0wYhHZl4I77nEGDrGgl18TVwrZcSSbg)
Or maybe there should be completely different way to create component variants.
For instance with BaseText from the docs, just write all the styles inside createStyleSheet, not in the theme itself. Then introduce "variant" prop inside the component and then just choose the desired variant like styles[variant] and pass it down to the component.
Also this way provides access to theme colors and margins, because when you define a theme, there is no way to referrer to another property inside the theme.
Beta Was this translation helpful? Give feedback.
All reactions