Uniwind provides device-specific CSS functions that automatically adapt to platform characteristics. These functions help you create responsive styles that work seamlessly across different devices and screen densities.
CSS functions must be defined as utilities in your global.css file before use. You cannot use them directly in className props with arbitrary values.
Multiplies a base font size by the device’s font scale setting (accessibility setting). This ensures your text respects user preferences for larger or smaller text.Define in global.css
You can pass a numeric argument directly to fontScale() instead of wrapping it in calc():
/* Equivalent — prefer the first form */font-size: fontScale(0.9);font-size: calc(fontScale() * 0.9);
Usage Example
import { Text } from 'react-native'// Multiple text sizes<Text className="text-sm-scaled text-gray-600">Small text</Text><Text className="text-base-scaled">Regular text</Text>
Multiplies a value by the device’s pixel ratio. Useful for creating pixel-perfect designs that scale appropriately across different screen densities.Define in global.css
Returns different values based on the current theme mode (light or dark). This function automatically adapts when the theme changes, making it perfect for creating theme-aware styles without manual theme switching logic.Define in global.css
import { View, Text } from 'react-native'<View className="bg-adaptive border-adaptive border p-4 rounded-lg"> <Text className="text-adaptive"> This text and background automatically adapt to light/dark theme </Text></View>
The light-dark() function is particularly useful for maintaining color consistency across themes without needing separate CSS variables for each theme.