Expo App UIExpo App UI
Helpers

normalizeSize

A utility function to normalize font sizes based on device font scale for Expo React Native. Learn how to use normalizeSize to handle accessibility settings.

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

On this page

Find this useful?

Buy me a coffee