A phone draws its own interface on top of yours: the camera cutout or notch, the status bar, the home indicator, the Android navigation bar. The safe area is the part of the screen those elements don't cover, and keeping buttons and text inside it is your job, because Android apps now draw behind the system bars too. react-native-safe-area-context gives you the safe area in two forms, a wrapper view and a set of numbers.
Key terms
- SafeAreaView: a regular
Viewthat applies the safe area insets as extra padding or margin on the edges you choose. - useSafeAreaInsets: a hook that returns the current insets as numeric
top,right,bottomandleftvalues. - SafeAreaProvider: the component that must sit above every
SafeAreaViewanduseSafeAreaInsetscall, and supplies their inset values. - Edge-to-edge: the Android layout where app content draws behind the status bar and the navigation bar.
Android draws behind the system bars
Before edge-to-edge, Android apps commonly had a translucent status bar and navigation bar, and the content behind them already sat underneath, so many apps never thought about safe areas there. With edge-to-edge, your content draws behind the system bars, and you keep it clear with safe areas, the same as on an iPhone with a notch.
There is no switch to turn this off in SDK 58. Android 16 makes edge-to-edge mandatory, and prebuild warns you to remove an android.edgeToEdgeEnabled entry if your app config still has one. A screen with a button at the bottom and no bottom inset puts that button under the navigation bar.
Choosing edges
SafeAreaView takes the place of the View at the root of a screen. With no edges prop, it applies the inset on all four edges. Pass an array, and only the edges you list get the inset: every edge you leave out is off. The four names are 'top', 'right', 'bottom' and 'left'.
The cart screen below lists 'top' and 'bottom' in edges, so the title clears the status bar and the checkout button clears the home indicator or the navigation bar:
tsx<SafeAreaView edges={['top', 'bottom']} style={styles.screen}>
Without 'bottom' in that array, the checkout button would sit under the navigation bar on Android.
Padding you set yourself isn't lost. Each listed edge is in 'additive' mode, which adds the inset to the view's own padding, so paddingBottom: 16 on the screen style gives you the bottom inset plus 16. For an edge that is off, the view keeps only its own padding.
edges also accepts an object that gives each edge a mode: 'off', 'additive' or 'maximum'. With edges={{ top: 'additive', bottom: 'maximum' }}, the bottom gets the larger of the inset and your own padding instead of their sum, which keeps a footer from doubling its spacing above a tall inset.
The mode prop decides how the inset is applied, as 'padding' (the default) or 'margin'. It doesn't change which edges get one. The SDK 58 API reference also lists an emulateUnlessSupported prop, but the library itself has no such prop: besides the regular View props, SafeAreaView takes children, mode, edges and cornerAdaptation.
Insets as numbers
Some layouts need the inset as a value: an absolutely positioned button, an offset added to a custom header. useSafeAreaInsets() returns an object with numeric top, right, bottom and left, which you add to your own spacing. The floating button below does this in its style:
tsxstyle={[styles.fab, { bottom: insets.bottom + 16, right: insets.right + 16 }]}
The button sits 16 above the bottom inset on any device. Reach for the hook only when you need the numbers, though. It is the more advanced option and can perform worse than SafeAreaView when the device rotates, while SafeAreaView is implemented natively and updates without that delay.
Where the provider comes from
Both SafeAreaView and the hook read their values from a SafeAreaProvider higher in the tree. Call useSafeAreaInsets without one and it throws No safe area value available. Make sure you are rendering <SafeAreaProvider> at the top of your app.
Expo Router's root already wraps your app in a SafeAreaProvider, so in a Router project you don't add one. Without Expo Router, add SafeAreaProvider to the root component file, such as App.tsx, before any screen uses SafeAreaView. Projects from the default template already have the library, because Expo Router has it as a peer dependency. Elsewhere, install it with npx expo install react-native-safe-area-context.
On web, Expo Router's provider reports zero insets, and you handle the safe area with CSS env(safe-area-inset-*) instead.
Under a Stack header
Don't use SafeAreaView to move content below a Stack header. It applies only the status bar inset: with a transparent header the content stays under the header, and with an opaque header SafeAreaView adds a second top inset.
Code Examples
import { Pressable, ScrollView, StyleSheet, Text } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function CartScreen() {
return (
<SafeAreaView edges={['top', 'bottom']} style={styles.screen}>
<Text style={styles.title}>Your cart</Text>
<ScrollView contentContainerStyle={styles.list}>
{/* cart rows */}
</ScrollView>
<Pressable style={styles.checkout} onPress={() => {}}>
<Text style={styles.checkoutLabel}>Check out</Text>
</Pressable>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
screen: { flex: 1, paddingHorizontal: 16, paddingBottom: 16 },
title: { fontSize: 28, fontWeight: '700', marginVertical: 12 },
list: { gap: 12 },
checkout: { backgroundColor: '#1f6feb', borderRadius: 12, padding: 16 },
checkoutLabel: { color: '#ffffff', fontWeight: '600', textAlign: 'center' },
});import { Pressable, StyleSheet, Text } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
type NewNoteButtonProps = { onPress: () => void };
export function NewNoteButton({ onPress }: NewNoteButtonProps) {
const insets = useSafeAreaInsets();
return (
<Pressable
onPress={onPress}
style={[styles.fab, { bottom: insets.bottom + 16, right: insets.right + 16 }]}
>
<Text style={styles.label}>New note</Text>
</Pressable>
);
}
const styles = StyleSheet.create({
fab: {
position: 'absolute',
backgroundColor: '#1f6feb',
borderRadius: 24,
paddingHorizontal: 20,
paddingVertical: 12,
},
label: { color: '#ffffff', fontWeight: '600' },
});