React Native · Components
SafeAreaProvider
Overrides safe area values for the subtree.
Import
SafeAreaProvider
componentOverrides safe area values for the subtree. UIProvider places this itself (the safeAreaInsets prop); using it separately is only needed when a subtree needs different values (e.g. a non-fullscreen panel you draw yourself).
SafeAreaView
componentA view that applies the safe area as its own padding: content does not go under the notch, status bar or navigation bar. Values are live. Use it in views that touch the screen edge (values are relative to the window edges).
Examples
useSafeAreaInsets
functionSafe area insets. The component re-renders when the value changes (rotation, hiding the status/navigation bar, foldable screen, split screen). Works outside UIProvider too.
Values come from the library's own native module (react-native-safe-area-context is not required); if the module is not compiled (web, test) they are estimated.
Examples
estimateInsets
functionEstimate of safe area insets when there is no native module (web, test, an app whose native code is not compiled). Status bar height on Android; notch / Dynamic Island values by device size on iOS.
getSafeAreaInsets
functionCurrent safe area insets (relative to the window edges, dp/pt). Real values when the native module exists (notch, Dynamic Island, status and navigation bars, display cutout), otherwise an estimate. Inside a component use useSafeAreaInsets; it re-renders when the value changes.
subscribeSafeAreaInsets
functionRegisters a function called when the insets change (rotation, hiding the bars, foldable screen, split screen). Returns a function that unregisters it.
hasNativeSafeArea
functionWhether the native safe area module is compiled in this app. If false the values are estimates (see estimateInsets).
EdgeInsets
typeEdge insets (dp/pt): notch, status bar, navigation bar, display cutout.
Edge
typeScreen edge.
EdgeMode
typeHow an edge combines with the safe area:
"additive": the safe area is added to the padding in your style (default)."maximum": the larger of your style padding and the safe area is used (on devices without a notch your own padding still remains)."off": this edge is not applied.
SafeAreaProviderProps
interfaceSafeAreaProvider props.
| Name | Type | Description |
|---|---|---|
children? | ReactNode | Content. |
insets? | Partial<EdgeInsets> | undefined | Manually given insets: given edges override native values (tests, screenshots, custom layouts). Edges not given stay live. |
SafeAreaViewProps
interfaceSafeAreaView props.
Extends: ViewProps
| Name | Type | Default | Description |
|---|---|---|---|
ref? | Ref<ViewRef> | Ref of the underlying native view. | |
edges? | readonly Edge[] | Partial<Record<Edge, EdgeMode>> | all four edges | Edges to apply: a list (all "additive") or a per-edge mode. See EdgeMode. |
mode? | "padding" | "margin" | "padding" | Whether the inset is inner (padding) or outer (margin). |