-
Hi I am really glad to see this project you've achieved. It's greatful By any chance, can I know is there any feature about scaling like react-native-size-matters? If not, is there any feature to scale every styles included(like a style middleware)? thaks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Yes, you can easily achieve it. Please check this links: Docs for plugins: https://www.unistyl.es/reference/plugins/ |
Beta Was this translation helpful? Give feedback.
-
@jpudysz Thanks for all of your hard work on this library, it looks awesome. In our project we've been using Right now, we have a export const rem = (val: number) => (isTablet ? 18 : 16) * (isAndroid ? 1.08 : 1) * val And our theme looks like this: $rem: rem(1),
$fontSizeXS: "0.625rem",
$fontSizeSM: "0.8rem",
$fontSizeMD: "1rem",
$fontSizeLG: "1.25rem",
$fontSizeXL: "1.40rem",
$fontSizeXXL: "2rem",
$fontSizeXXXL: "3rem",
$gapXS: "0.3rem",
$gapSM: "0.625rem",
$gapMD: "1.25rem",
$gapLG: "1.875rem",
$gapXL: "2.5rem",
$gapXXL: "3rem",
... In components you can do this: const styles = createStyles({
icon: {
width: "100%",
fontSize: "1.5rem",
marginLeft: "$gapSM"
},
}) What approach would you recommend for this when we start using I could sort of see a combination of breakpoints and media queries work, but I'm not really sure: (1) what would be the most efficient / performant way to do this and (2) how to prevent a lot of boilerplate in our components. Perhaps a plugin, like mentioned here could work, but I'm not sure what it would look like. Thanks! |
Beta Was this translation helpful? Give feedback.
Yes, you can easily achieve it. Please check this links:
Docs for plugins: https://www.unistyl.es/reference/plugins/
Example plugin for scaling: https://github.com/jpudysz/react-native-unistyles/blob/main/examples/expo/src/plugins/autoGuidelinePlugin.ts