A phone rotates, a foldable opens, and the user can raise the system font size while your app is running. A layout that reads the window size once at startup keeps drawing for a window that no longer exists. useWindowDimensions keeps sizes current inside components, and two Text props decide how far your text follows the user's font setting.
Key terms
useWindowDimensions: a hook fromreact-nativethat returnswidth,height,scaleandfontScalefor the window and updates them when they change.Dimensions: the module underneath it, withDimensions.get('window'),Dimensions.get('screen')and a'change'event.fontScale: the font size scaling the user has chosen in the operating system settings.allowFontScaling: aTextprop that controls whether its fonts scale with the Text Size accessibility settings.maxFontSizeMultiplier: aTextprop that sets the largest scale a font can reach whileallowFontScalingis on.
Window versus screen
Dimensions reports two sizes. window is the size of the visible application window, and screen is the size of the device's screen. On Android, what the window covers depends on edge to edge. When the app draws edge to edge, the window includes the system bars. That is always the case for an app that targets SDK 35 or higher on Android 16 and up, and on Android 15 unless the app opts out. The 0.88 template targets SDK 36. Only when edge to edge is off does React Native subtract the status bar and navigation bar insets from the window. On iOS the window is the bounds of the app's key window. useWindowDimensions starts from Dimensions.get('window'), so the hook always reports the window.
The width and height you get are layout units, the same units as a width in a style. The useWindowDimensions reference calls them pixels, which is misleading: assign them to styles as they are, and convert with PixelRatio.getPixelSizeForLayoutSize only when you need physical pixels. scale itself is the device pixel ratio, 2 or 3 on a Retina or high DPI display.
Values computed at import time go stale
A tile sized from the window at the top of a module looks like this:
tsxconst { width } = Dimensions.get('window'); const styles = StyleSheet.create({ tile: { width: width / 2 }, });
Both statements run once, when the module is first loaded. StyleSheet.create returns the object you pass it, so width / 2 stays whatever number it was at that moment. Dimensions can change after startup, on rotation or when a foldable changes state, and the tile keeps its old width. Rendering logic and styles that depend on the window should read it on every render and apply the result as an inline style instead of a StyleSheet entry.
useWindowDimensions does that work for you. It subscribes to the Dimensions 'change' event in an effect and sets new state whenever width, height, scale or fontScale differ, so the component re-renders with current values. Inside React components it is the preferred API, because a value read once from Dimensions doesn't update when the window does. Outside components, Dimensions.addEventListener('change', handler) returns a subscription that you clean up by calling remove().
A product grid that reflows
The ProductGrid example picks two columns on a narrow window and three from a width of 600 up, then computes each tile's width from the current window.
const { width, fontScale } = useWindowDimensions(); runs on every render, and each tile receives { width: tileWidth, minHeight: 96 * fontScale } inline, while the fixed parts (padding, radius, colors) stay in the StyleSheet. Rotate the phone and the hook's state update re-renders the grid with the new column count and tile width.
How far text can grow
fontScale reflects the user's font size choice: Settings > Display > Font size on Android, and Settings > Display & Brightness > Text Size on iOS, which Settings > Accessibility > Display & Text Size > Larger Text can also change. The hook updates when that setting changes, which is why the grid ties minHeight to it. Sizing padding, margins and container heights with fontScale lets the layout keep up with larger or smaller text.
Text scales by default, because Text treats allowFontScaling as true unless you pass false. Turning it off ignores the user's Text Size setting for that text, so a cap is usually the better tool. maxFontSizeMultiplier sets the largest scale a font can reach while scaling is on:
- Leave it unset (
nullorundefined) to inherit from the parent node or the global default, which is0. - Pass
0for no maximum, ignoring the parent and the global default. - Pass
1or more to set this node's own limit.
In the grid, the product name has maxFontSizeMultiplier={1.5}, so it follows the user's setting until it reaches one and a half times its fontSize, and the price scales without a limit.
Code Examples
import { StyleSheet, Text, View, useWindowDimensions } from 'react-native';
type Product = { id: string; name: string; price: string };
const GUTTER = 12;
export function ProductGrid({ products }: { products: Product[] }) {
const { width, fontScale } = useWindowDimensions();
const columns = width >= 600 ? 3 : 2;
const tileWidth = (width - GUTTER * (columns + 1)) / columns;
return (
<View style={styles.grid}>
{products.map(product => (
<View
key={product.id}
style={[styles.tile, { width: tileWidth, minHeight: 96 * fontScale }]}
>
<Text style={styles.name} maxFontSizeMultiplier={1.5}>
{product.name}
</Text>
<Text style={styles.price}>{product.price}</Text>
</View>
))}
</View>
);
}
const styles = StyleSheet.create({
grid: {
flexDirection: 'row',
flexWrap: 'wrap',
paddingTop: GUTTER,
paddingLeft: GUTTER,
},
tile: {
marginRight: GUTTER,
marginBottom: GUTTER,
padding: 12,
borderRadius: 12,
backgroundColor: '#f4f4f5',
},
name: { fontSize: 16, fontWeight: '600' },
price: { fontSize: 14, marginTop: 4 },
});