Theme
Nativewind uses the same theme values as as Tailwind CSS. You can read more about how to configure your project through the Tailwind CSS documentation.
Fully dynamic React Native applications often make use of helper functions such as Platform.select
and PixelRatio
. Nativewind exports helpers allowing you to embed these functions into your theme.
platformSelect
platformSelect
is the equivalent to Platform.select()
.
platformColor()
Equivalent of PlatformColor
. Typically used with platformSelect
.
hairlineWidth()
Equivalent of StyleSheet.hairlineWidth
pixelRatio()
Equivalent of PixelRatio.get()
. If a number is provided it returns PixelRatio.get() * <value>
, otherwise it returns the PixelRatio value.
pixelRatioSelect()
A helper function to use PixelRatio.get()
in a conditional statement, similar to Platform.select
.
fontScale()
Equivalent of PixelRatio.getFontScale()
. If a number is provided it returns PixelRatio.getFontScale() * <value>
, otherwise it returns the PixelRatio.getFontScale()
value.
fontScaleSelect()
A helper function to use PixelRatio.getFontScale()
in a conditional statement, similar to Platform.select
.
getPixelSizeForLayoutSize()
Equivalent of PixelRatio.getPixelSizeForLayoutSize()
roundToNearestPixel()
Equivalent of PixelRatio.roundToNearestPixel()