React Native MantineLayout

MediaQuery

Responsive visibility control

Import: import { MediaQuery } from 'react-native-mantine';

Usage

import { MediaQuery, Text } from 'react-native-mantine';

<MediaQuery largerThan={768}>
  <Text>Visible only when the window is at least 768px wide</Text>
</MediaQuery>

<MediaQuery smallerThan={768} orientation="portrait">
  <Text>Visible on narrow portrait screens</Text>
</MediaQuery>

Props

PropTypeDefaultDescription
minWidthnumberMinimum width for the query to match
maxWidthnumberMaximum width for the query to match
minHeightnumberMinimum height for the query to match
maxHeightnumberMaximum height for the query to match
largerThannumber | stringShorthand for minWidth (convenience prop)
smallerThannumber | stringShorthand for maxWidth (convenience prop)
orientation'portrait' | 'landscape'Orientation to match
childrenReact.ReactNodeChildren to render when query matches
query'window' | 'screen''window'Query type - window or screen
styleStyleProp<ViewStyle>Additional styles applied to the root element
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm