DocumentationHelpersnormalizeSize

normalizeSize

A utility function to normalize font sizes based on device font scale

Installation

npx expo-app-ui add normalizeSize

Usage

import { normalizeSize } from "@/helper/normalizeSize";

Function Signature

normalizeSize(size: number): number

Parameters

ParameterTypeDescription
sizenumberThe base font size to normalize

Returns

TypeDescription
numberThe normalized font size

Examples

Basic Usage

const fontSize = normalizeSize(16);
// On normal devices: returns 16
// On devices with large text: returns ~13.6

In StyleSheet

const styles = StyleSheet.create({
  text: {
    fontSize: normalizeSize(18),
  },
});

Features

  • Automatic font scale detection
  • Adjusts for accessibility settings
  • Prevents text from becoming too large
Made by Krish Panchani X Thunder Develops • Built with ❤️ for the Expo React Native community
📦 View on npm