rem units
Fluffle supports rem units for scalable and consistent sizing across devices.
Basic usage
Use rem values as strings in supported style properties.
ts
const styles = StyleSheet.create({
text: {
fontSize: "1rem",
},
container: {
padding: "2rem",
},
});
How it works
1rem is based on a root font size, adjusted by the device's font scale.
- iOS default: 17
- Android default: 14
Configuration
You can override the root font size by adding this to your app's initialization file (e.g. App.tsx):
ts
import { StyleSheet } from "@bibliolabs/react-native-fluffle";
StyleSheet.configRem.setRootFontSize(16);
Notes
- Only supported style properties accept
rem - Values are resolved to numbers at runtime