Skip to content

Support height media queries #586

Description

@antoinerousseau

What happened?

I wanted to add a tall breakpoint, to target taller screens, like this:

@custom-variant tall (@media (min-height: 700px));

So that I could do stuff like text-md tall:text-lg

But it does not seem to work or be supported. Any plan to add it?

Meanwhile I went with a hook; it works too but is less gracious:

export function useIsTallScreen() {
  const { height } = useWindowDimensions();
  return height > 700;
}
const isTallScreen = useIsTallScreen();
return <Text className={cn("text-white", isTallScreen ? "text-lg" : "text-md")}>Hello, World!</Text>

Steps to Reproduce

  1. Add @custom-variant tall (@media (min-height: 700px)); to your CSS file
  2. Add text-md tall:text-lg to a Text
  3. Check on smaller and bigger screens: text size should vary

Snack or Repository Link (Optional)

No response

Uniwind version

Pro 1.4.0

React Native Version

0.85.3

Platforms

Android, iOS

Expo

Yes

Additional information

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions