Sanniv Khare 6 min read

Edge-to-edge at targetSdk 36: safe-area-context 5.11, diffed

Edge-to-edge at targetSdk 36: safe-area-context 5.11, diffed

If your React Native app targets API 36, move react-native-safe-area-context to 5.11.1 and stop looking for an opt-out: on Android 16 devices there is none. React Native 0.88.1 already switches the window to edge-to-edge for you, so MainActivity needs no extra call. What 5.11 adds on Android is an inset calculation that also reads the insets a parent view dispatches, a fresh insets request when a provider attaches, and a new cornerAdaptation prop for rounded display corners.

This is a source diff. We packed react-native-safe-area-context 5.10.1 (29 Sep 2026), 5.11.0 (27 Oct 2026) and 5.11.1 (3 Nov 2026) from npm and diffed their android/ folders, then read the Android sources of react-native 0.88.1, its Gradle plugin and the 0.88.1 app template. The Android rules come from Google’s behaviour-change pages for Android 15, 16 and 17. Runtime behaviour on a device is outside this post.

Why we did this: our React Native work on Android (banking-style apps, Peepal and Shopkeeper) sits on the same stack: a RN template that targets API 36, and screens that pad themselves with safe-area insets. Before any of those move to RN 0.88, we want to know which part of edge-to-edge the framework handles and which part the library handles.

The Android rules, by targetSdk

Every row below is linked to the page it came from.

Target On an Android 15 device On an Android 16 device Source
API 35 Edge-to-edge by default; windowOptOutEdgeToEdgeEnforcement can opt out Edge-to-edge; the attribute still works for API 35 targets Behaviour changes, Android 15
API 36 The attribute “continues to work” The attribute “is disabled”; no opt-out Behaviour changes, Android 16
API 37 Same as 36 Same as 36; the Android 17 page adds no edge-to-edge change Behaviour changes, Android 17

Google’s Android 16 page puts it in one line: for apps targeting API 36, R.attr#windowOptOutEdgeToEdgeEnforcement “is deprecated and disabled, and your app can’t opt-out of going edge-to-edge.” The Android 15 page also explains the bars: the status bar is transparent, setStatusBarColor has no effect, and with 3-button navigation the bar gets an 80% opaque scrim while navigationBarContrastEnforced is true. The edge-to-edge guide says to set isNavigationBarContrastEnforced to false if you want no translucent scrim there.

What React Native 0.88.1 already does

The 0.88.1 template ships targetSdkVersion = 36, compileSdkVersion = 37 and edgeToEdgeEnabled=true in gradle.properties. Its MainActivity.kt has no enableEdgeToEdge() call, and it does not need one. The Gradle plugin reads edgeToEdgeEnabled and writes WindowUtilKt.setEdgeToEdgeFeatureFlagOn() into the generated entry point. Then ReactActivityDelegate calls updateEdgeToEdgeFeatureFlag(activity) when the activity is created:

The condensed RN 0.88.1 function that decides whether the window goes edge-to-edge

Condensed from ReactAndroid/.../views/view/WindowUtil.kt in react-native 0.88.1.

So on an Android 16 device with targetSdk 35 or higher, the flag is on whatever your theme says. On Android 15 the theme attribute still decides. When the flag is on, Window.enableEdgeToEdge() in the same file:

  • calls WindowCompat.setDecorFitsSystemWindows(this, false),
  • makes the status bar and (from API 29) the navigation bar transparent,
  • reads the theme’s android:enforceNavigationBarContrast (default true) and passes it to isNavigationBarContrastEnforced, so the 3-button scrim is a theme decision,
  • sets layoutInDisplayCutoutMode to ALWAYS from API 30.

The same flag also forces statusBarTranslucent and navigationBarTranslucent to true on <Modal> (ReactModalHostView.kt), so a modal draws under the bars too and needs its own insets.

The practical point: in a RN 0.88 app the work left for you is in JavaScript layout, not in MainActivity. Every screen has to pad itself, which is the job of react-native-safe-area-context.

safe-area-context 5.10.1 to 5.11.1: the Android diff

The Android sources of 5.11.0 and 5.11.1 are identical; 5.11.1 changed only iOS and JavaScript files. Between 5.10.1 and 5.11.1, nine Android files changed and one was added (SafeAreaCornerAdaptation.kt).

Insets now include what a parent dispatches

SafeAreaUtils.kt in 5.10.1 and 5.11.1, condensed

Condensed from SafeAreaUtils.kt; the full functions are in the npm packages.

In 5.10.1, getSafeAreaInsets(view) read only rootView.rootWindowInsets. In 5.11 it takes a second argument, the WindowInsets that were dispatched to the provider (or to a SafeAreaView acting as its own provider), and merges the two with a new maxInsets(): each edge is the larger of the root value and the dispatched value. The comment in the source gives the reason: ancestors also lower insets “without making that area safe”, for example RN’s translucent StatusBar, which sets the top inset to 0. So a parent can add to the safe area but never shrink it.

The dispatched value is captured by a new dispatchApplyWindowInsets override on SafeAreaProvider and SafeAreaView, stored in a small DispatchedWindowInsets class. That class drops the stored value when view.rootWindowInsets has changed since the dispatch, because an ancestor that consumed the insets stops sending new ones and the old value would be stale.

On API 23 to 29 the bottom edge is still min(systemWindowInsetBottom, stableInsetBottom), so the soft keyboard never counts as safe area. The new comment notes this also caps extra bottom insets added by an ancestor.

A fresh request on attach

Both SafeAreaProvider.onAttachedToWindow() and a self-providing SafeAreaView now call requestApplyInsets() (API 23+). The source comment: views attached after the last dispatch “only receive insets on the next one”. This matters for screens mounted late, such as a provider inside a navigator screen or a modal.

Corner adaptation (API 31+)

The new file adds CornerAdaptation (NONE, VERTICAL, HORIZONTAL) and reads the display’s rounded corners with WindowInsets.getRoundedCorner(), which exists from API 31. For each corner it computes an inset of r * (1 - √2 / 2) of an effective radius, the same rule the KDoc says matches UIKit’s edgeInsets(for: .safeArea(cornerAdaptation:)) on iOS 26. Below API 31 the insets come back unchanged.

On the JavaScript side this shows up as:

// SafeArea.types.ts, 5.11.1
export type CornerAdaptation = 'vertical' | 'horizontal';

export interface Metrics {
  insets: EdgeInsets;
  frame: Rect;
  verticalCornerAdaptedInsets?: EdgeInsets;
  horizontalCornerAdaptedInsets?: EdgeInsets;
}

SafeAreaView gets a cornerAdaptation prop (codegen default 'none'), and the provider exports a new SafeAreaCornerAdaptedInsetsContext. Both fields default to the regular insets, so nothing changes unless you opt in.

Build files

android/build.gradle raised its fallback compileSdkVersion from 30 to 31, needed for RoundedCorner. Apps that set compileSdkVersion in the root project (the RN template sets 37) are not affected.

What to check on your own app

  1. Run npm ls react-native-safe-area-context. The 0.88.1 template asks for ^5.5.2, so a new install resolves to 5.11.1, but an old lockfile can keep you on an earlier 5.x.
  2. Remove android:windowOptOutEdgeToEdgeEnforcement from your theme if it is there. On Android 16 it does nothing for an API 36 target, and on Android 15 it makes your layout differ between OS versions.
  3. Search for fitsSystemWindows and for native setOnApplyWindowInsetsListener code that returns modified insets. With 5.11 those dispatched values now feed the safe area, but only upwards.
  4. Check every <Modal>: with edge-to-edge on, it is translucent under both bars, so wrap its content in a SafeAreaView or read useSafeAreaInsets() inside it.
  5. Decide on the 3-button navigation scrim with android:enforceNavigationBarContrast in your theme rather than in code, since RN 0.88.1 reads that attribute.
  6. Leave cornerAdaptation off unless content sits in a screen corner (a floating button, a full-bleed card); then try 'vertical' on that view only.
  7. Look at one list screen with gesture navigation and one with 3-button navigation on an Android 16 or 17 emulator before you ship.

Sources

Made by the team behind this post

Apps from our studio

  • Goes with this post

    BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get
  • Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.