Pre-render Measurement
Know the exact height and line count of any text before it renders. No more layout jumps, no hidden render passes.
Native Precision
Uses CoreText on iOS and StaticLayout on Android — the same engines React Native uses internally.
Blazing Fast Cache
Two-tier LRU cache achieves 95%+ hit rate. Warm cache runs at 2–5M ops/s.
Quick Example
import { useTextLayout } from 'pretext-native';
const { height, lineCount, isTruncated } = useTextLayout({
text,
width: 320,
fontSize: 15,
lineHeight: 22,
maxLines: 3,
});