The responsive styling experience of tailwindcss is great. Mobile-first, then sm:, md:, lg:, xl: prefixes for breakpoints.
When thinking about the function-helpers in for lineHeight in issue #48, I thought that maybe this could work for responsive helpers, too.
Imagine:
import { t, md, xl } from 'react-native-tailwindcss';
<View style={[t.w16, md(t.w24), xl(t.w32)]} />
Internally, the helpers would look something like:
const md = (styles) => Dimensions.get('window').width > 1000 ? styles : undefined
The question is -- would this "screen-width breakpoints" approach be helpful in react-native?
I've been watching some approaches to responsive styling, and I'm not quite sure yet.
So, any thoughts?
It could be reasonable to omit all of this from rn-tailwind, and rely on other utilities for this functionality.
On the other hand, this is a pretty central feature to tailwind (IMO).
After reviewing the above repos, I think there could be a place for tailwinds "increasing-breakpoints" approach (min-width queries only, no max-width or ranges). "Scaling" approaches should probably stay in their own utilities.. could always do scaleSizeUtilityFromOtherLibrary(t.w16.width) or similar
The things I still want to brainstorm on are PixelRatio and orientation -- these exist on web too, but perhaps they're more critical in nativeland? Should the sm, md, etc breakpoints be based on screen width, or minimum-edge length?
If you've gotten this far, thanks a lot for reading!
The responsive styling experience of tailwindcss is great. Mobile-first, then
sm:,md:,lg:,xl:prefixes for breakpoints.When thinking about the function-helpers in for lineHeight in issue #48, I thought that maybe this could work for responsive helpers, too.
Imagine:
Internally, the helpers would look something like:
The question is -- would this "screen-width breakpoints" approach be helpful in react-native?
I've been watching some approaches to responsive styling, and I'm not quite sure yet.
remunits at buildtime. Left up to user.. seems difficult to use wellvh&vw, plus "vw for fontSize"So, any thoughts?
It could be reasonable to omit all of this from rn-tailwind, and rely on other utilities for this functionality.
On the other hand, this is a pretty central feature to tailwind (IMO).
After reviewing the above repos, I think there could be a place for tailwinds "increasing-breakpoints" approach (
min-widthqueries only, nomax-widthor ranges). "Scaling" approaches should probably stay in their own utilities.. could always doscaleSizeUtilityFromOtherLibrary(t.w16.width)or similarThe things I still want to brainstorm on are
PixelRatioandorientation-- these exist on web too, but perhaps they're more critical in nativeland? Should thesm,md, etc breakpoints be based on screen width, or minimum-edge length?If you've gotten this far, thanks a lot for reading!