DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › Android 16

Fix React Native Back Button Exits on Android 16 (Target SDK 36)

By Freedom251 Team · · 12 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the Android system Back button now closes your React Native app after you changed targetSdkVersion to 36, Android 16 predictive-back behavior is usually the trigger. On Android 16 devices, apps targeting API 36 no longer receive the legacy Activity.onBackPressed() callback or KeyEvent.KEYCODE_BACK. A native Activity or module that still depends on either hook can fail to consume the event, allowing React Native to fall through to its default behavior: exiting the app when no JavaScript back listener returns true.

The durable fix is to migrate native handling to AndroidX OnBackPressedDispatcher/OnBackPressedCallback or the platform OnBackInvokedCallback, then make sure each React Native screen uses BackHandler correctly. If migration cannot be completed immediately, disable predictive-back callbacks with android:enableOnBackInvokedCallback='false' for the application or affected Activity. That is a compatibility stopgap, not the final solution.

As an Amazon Associate I earn from qualifying purchases.

What changed when the app started targeting API 36

Android 16 introduces a behavior change for applications targeting Android 16 (API level 36) and running on an Android 16 or newer device. Predictive-back animations, including back-to-home, cross-task, and cross-activity transitions, are enabled by default. At the same time, Android stops calling onBackPressed() and stops dispatching KeyEvent.KEYCODE_BACK to those target-36 applications.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Older React Native integrations and many native modules intercepted back through one of those legacy entry points. Once the callback disappears, the native layer may never forward the event to the JavaScript navigation stack. React Native’s BackHandler then follows its documented fallback: if no registered handler consumes the event, the default system action exits the Activity, which looks like a navigation failure but is actually an unconsumed back event.

#1 Best Overall
Yojaro 4Pack Silicone Suction Phone Case Mount, Silicon Adhesive Smartphones Stand Sticky, Hands-Free Phone Accessories Holder for Selfies and Videos (Black & White & Translucent & Light Pink)
  • 【Strong Adsorption】The inspiration of the silicone phone suction case comes from the adhesive force of the octopus. Each suction cup phone mount is 3.15 inches long and 2.17 inches wide, with 24 independent suction cups providing a stronger and more stable suction force, so you don't have to worry about your phone falling during use.
  • 【Back of Phone Suction Grip】Remove the adhesive film on the phone suction cup and stick it on the phone case. You can then fix the phone on any smooth surface, which is very convenient. (The phone suction cup cannot be removed and reused after being attached to the phone case. It is recommended to attach it to a regular phone case, not a valuable one.)
  • 【Widely Used】Our non-slip silicone phone sticky grip mount attaches to almost any flat phone case and make it compatible with common mobile phones such as iPhone and Android.You can shoot, watch videos or video calls in the kitchen, gym, dance studio, bathroom and other places.
  • 【Capture the Wonderful Picture】Whether you are a TikTok creator or just like to share videos and photos, this phone suction cup can help you hands-free capture wonderful videos and photos for sharing with friends.
  • 【Note】You can fix the phone suction cup on a smooth surface such as a mirror or glass. If necessary, wipe the suction cup with a damp cloth to obtain stronger suction. Before releasing your hand, make sure the phone is firmly fixed. (Not applicable to rough walls, wooden surfaces, and other uneven surfaces)
Area Before Android 16 target-36 behavior Android 16 with target SDK 36
Legacy Activity hook Activity.onBackPressed() could be overridden. onBackPressed() is not called.
Legacy key event KEYCODE_BACK could be intercepted. KeyEvent.KEYCODE_BACK is not dispatched.
Predictive animation Not universally enforced. Enabled by default for supported back-to-home, cross-task, and cross-activity animations.
React Native fallback A native or JavaScript listener might consume back before the system exits. If no listener returns true, React Native allows the default exit behavior.

This is why the problem often appears immediately after changing only the target SDK. The JavaScript navigation code may be unchanged; the Android platform has changed which native interception points are valid.

First determine whether JavaScript or native code owns the failure

Do not start by adding multiple BackHandler listeners. Identify which layer stopped receiving the event.

Check the target and device combination

  • Confirm the built APK or AAB targets API 36, not only that the project contains an API 36 compile SDK.
  • Reproduce on an Android 16 device or emulator. A pre-Android-16 device can continue exercising legacy behavior and hide the defect.
  • Record whether the device uses gesture navigation or three-button navigation. Android 16 extends predictive-back behavior to three-button navigation too.

Check for a JavaScript-only issue

If a screen has no native Activity override or native module that owns an Activity, temporarily add a focused BackHandler listener and log when it runs. If the log appears and the listener returns true while navigating, the event reached JavaScript and the bug is in screen ownership or navigation logic. If the log never appears, inspect the native host and dependencies before changing navigation code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check custom native ownership

Look in your application and every Android dependency for:

  • onBackPressed() overrides in Activities or Fragments.
  • KeyEvent.KEYCODE_BACK checks in dispatchKeyEvent, onKeyUp, or similar methods.
  • A custom ReactActivity, ReactFragmentActivity, or host Activity that forwards back manually.
  • Native modules that launch their own Activity, modal, video view, document picker, or authentication flow.

Use a repository-wide search rather than checking only MainActivity:

rg -n 'onBackPressed|KEYCODE_BACK|dispatchKeyEvent|onKeyUp' android node_modules

For a dependency issue, inspect the exact Android source or version pulled into the build. A library can retain a legacy override even when your own Activity is already migrated.

Rank #2
Apple EarPods Headphones with USB-C Plug, Wired Ear Buds with Built-in Remote to Control Music, Phone Calls, and Volume
  • SUPERIOR COMFORT — Unlike traditional circular ear buds, the design of EarPods is defined by the geometry of the ear. Which makes them more comfortable for more people than any other ear bud–style headphones.
  • HIGH-QUALITY AUDIO — The speakers inside EarPods have been engineered to maximize sound output and minimize sound loss, which means you get high-quality audio.
  • BUILT-IN REMOTE — EarPods with USB-C plug also include a built-in remote that lets you adjust the volume, control the playback of music and video, and answer or end calls with a pinch of the cord.
  • COMPATIBILITY — Works with all devices that have a USB-C port.
  • INTEGRATED MICROPHONE — A built-in microphone precisely captures your voice while you’re on the phone, taking a FaceTime call, or summoning Siri — so you’re always heard loud and clear.

Migrate native back handling to AndroidX

Android’s backward-compatible recommendation is OnBackPressedDispatcher with an OnBackPressedCallback. The dispatcher is available through AndroidX and provides one handling model across older Android releases and Android 16. It also participates in the predictive-back path instead of relying on the removed legacy callback.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Replace an Activity override

Remove the custom onBackPressed() override and register a callback from the Activity lifecycle. The callback should be enabled only while that Activity or feature owns back. Its handler must either complete the native action or deliberately delegate to the next owner.

class MainActivity : ReactActivity() {
    private val backCallback = object : OnBackPressedCallback(true) {
        override fun handleOnBackPressed() {
            // Handle native state here, or call the app's React Native bridge.
            // Set isEnabled = false before delegating if another owner must run.
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        onBackPressedDispatcher.addCallback(this, backCallback)
    }
}

The exact delegation code depends on how your host Activity communicates with React Native. Do not invent a second navigation stack in the Activity. If React Native owns navigation, route the dispatcher event through the React Native back-handler integration and let the active screen decide whether it consumed the event.

Use a Fragment-scoped callback when a Fragment owns the UI

Register the callback against the Fragment’s view or lifecycle owner when the Fragment is visible, and disable or remove it when the Fragment is stopped. This prevents an invisible Fragment from consuming the event intended for the current screen. If a nested Fragment, native modal, or child navigator is active, make that owner the enabled callback and release it when the child closes.

Use the platform callback when direct predictive-back control is required

OnBackInvokedCallback is the platform API for predictive back on newer Android versions. Register it only on API levels that provide the API, and keep a compatible path for older releases. Use this option when a native component needs direct platform control and can correctly manage callback priority and lifecycle.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
if (Build.VERSION.SDK_INT >= 33) {
    onBackInvokedDispatcher.registerOnBackInvokedCallback(
        OnBackInvokedDispatcher.PRIORITY_DEFAULT
    ) {
        // Consume or delegate the back action for this Activity.
    }
}

Most React Native applications should prefer the AndroidX dispatcher unless a native component has a specific reason to use the platform callback. Both approaches are supported predictive-back mechanisms; neither requires restoring an onBackPressed() override.

Rank #3
PopSockets Adhesive Phone Grip, Holder- Black | Anti-Drop, Kickstand, Secure Comfortable Hold, Black, Create a Mobile Phone Outfit
  • Secure Hold: Our PopSockets adhesive phone grip gives your cell phone a secure, comfortable hold in hand to help prevent drops while texting, taking photos, or scrolling on the go. Designed to stick firmly to most phone cases and devices.
  • Hands-Free Made Easy: Easily turn your PopSocket into a phone stand to prop up your phone anywhere, perfect for watching videos, video calls, or following recipes. A must-have phone holder that keeps your device secure and ready for anything.
  • Compatibility: Works with all phones, tablets, and Kindles. Sticks best to smooth, hard plastic cases and may not adhere to silicone or textured cases. Easily swap your PopTop to change up your style.
  • Black PopSockets: Simple, refined, and endlessly versatile. A timeless essential for any phone.
  • Travel Must-Have for People On the Go: A must-have travel accessory for flights, flying, airports, air travel, airplanes, planes, international trips, cruises, and long travel days. Key gadget for your airport haul, travel accessories and must-haves.

Honor the React Native host contract

React Native’s integration guidance states that on Android 16 devices running an app targeting API 36, onBackPressed will no longer be called and OnBackPressedDispatcher should be used. A custom host Activity therefore has two responsibilities: receive back through the dispatcher and pass it into the React Native back-handler path rather than silently finishing the Activity. Review any host changes made for splash screens, multiple React roots, fragments, or custom navigation before enabling the callback.

Make the JavaScript BackHandler consume only what it handles

At the JavaScript layer, BackHandler is a contract, not a notification that can be ignored. A listener returns true after it has handled the event. It returns false when the current screen has nothing to consume and the event should continue to navigation or the system. If every listener returns false, or no listener is registered, the default behavior can exit the app.

import { useEffect } from 'react';
import { BackHandler } from 'react-native';

function DetailsScreen({ navigation }) {
  useEffect(() => {
    const subscription = BackHandler.addEventListener(
      'hardwareBackPress',
      () => {
        if (navigation.canGoBack()) {
          navigation.goBack();
          return true;
        }
        return false;
      },
    );

    return () => subscription.remove();
  }, [navigation]);

  return null;
}

Adapt the ownership check to your navigation library. A screen with an open drawer, selection mode, unsaved editor, expanded sheet, or native overlay should close that state first and return true. A root screen with no local state should return false so the system can perform its normal root-level action.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prevent stale listeners

  • Register the listener when the screen becomes active and remove it in the effect cleanup.
  • Keep the callback tied to the current navigation object and screen state so it does not capture obsolete values.
  • Do not register the same global listener from every screen unless you have an explicit priority and ownership design.
  • Return true only after the state change has been initiated; returning true without doing anything traps the user on the screen.

Account for native screens and modals

A native module that presents its own Activity may consume back before the React Native root receives it. That Activity needs its own dispatcher callback and must finish or delegate deliberately. Conversely, a React Native modal that is only a JavaScript view should be closed by the active screen’s BackHandler listener before returning true.

Temporary compatibility opt-out

If a release must ship before native migration is complete, disable the predictive-back callback behavior for the application or the specific Activity in AndroidManifest.xml:

<application
    android:enableOnBackInvokedCallback='false'
    ... />

Place the attribute at the narrowest scope that contains the legacy code. If only one native Activity is incompatible, putting the flag on that Activity avoids changing behavior for the rest of the app. If the old handling is shared by the whole host, the application scope may be necessary.

Rank #4
Sale
360° Rotating Stainless Steel Phone Tether Tab (Silvery 3-Pack) - Universal for iPhone & Other Phones (Fits Wristbands/Necklaces/Crossbody Straps)
  • [360 ° Flexible Rotation Design] Comes with a rotatable lanyard ring that supports 360 ° free rotation, effectively solving the problem of twisted and tangled lanyards
  • [Wide compatibility] The ultra-thin 0.02-inch design does not block the charging port at all, and both wired and wireless charging can be used directly without removing the pad. Compatible with most smartphones such as iPhone, compatible with various wristbands, lanyards, crossbody straps, and keychains
  • [Durable and Portable Material] Premium rust-resistant stainless steel material with good flexibility, which not only avoids scratching the phone case, but also has excellent anti rust and anti fading performance
  • [Multi scenario Practical] Paired with a lanyard or wristband, hands-free use can be achieved. The phone is within reach and not easily dropped, ideal for daily commuting and outdoor activities. Suitable for full coverage phone cases, does not support half coverage phone cases
  • [Quality Service] If you find any damage or other issues with the product upon receipt, please contact us immediately. We will handle it quickly

This flag is temporary. It suppresses predictive-back callback behavior for the selected scope, so the app gives up the Android 16 predictive animation there. It does not convert onBackPressed() into a future-proof API, and it does not fix a JavaScript listener that incorrectly returns false. Remove the flag after replacing legacy interception and completing Android 16 tests.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

React Native version guidance

React Native 0.81 defaults to targeting Android 16/API 36. Its release guidance says the BackHandler API should continue to work for most use cases, while applications with custom native back handling, such as an onBackPressed() override, may require manual migration or a temporary opt-out. The practical implication is that upgrading React Native can address framework compatibility, but it cannot automatically rewrite your Activity, an embedded SDK, or a private native module.

When upgrading, compare the React Native version, Android Gradle Plugin, compile SDK, and target SDK as a set. Build a release-like variant, because a debug-only host, flavor manifest, or dependency exclusion can hide the Activity that fails in production. Keep a record of every custom native back hook removed or replaced so a later dependency upgrade does not reintroduce it.

Test the migration on both navigation modes

Run the following matrix on an Android 16/API 36 device or emulator. Test a release build as well as debug, because minification, manifest merging, and flavor-specific Activities can change the result.

Scenario Expected result What a failure indicates
Gesture navigation, details screen Back animation appears and the details screen navigates to its parent. The dispatcher or JavaScript listener is not consuming the event.
Three-button navigation, details screen Back button performs the same navigation as the gesture. Handling was tested only on gestures or a legacy key path remains.
Nested navigator The innermost stack pops before the parent stack or Activity. Callback scope or listener ownership is too broad.
Open drawer, sheet, or selection mode The local UI state closes and the app remains on the same screen. The screen returns false before clearing local state.
Root screen The app follows the intended system/root behavior. A global listener traps the user or an unhandled event exits unexpectedly.
React Native modal The modal closes before the underlying screen. Modal ownership is not connected to the active BackHandler.
Native Activity or module The native owner closes or delegates, then React Native resumes normally. The module still overrides onBackPressed() or consumes without delegation.
Cold start and resumed app Back works after launch, background/foreground, and configuration changes. Callback lifecycle registration is tied to a destroyed Activity or stale host.

While testing, watch log output for the native callback and the JavaScript listener separately. A native log with no JavaScript log points to the bridge or host integration. A JavaScript log that returns true but leaves the screen unchanged points to navigation state, not Android dispatch. No logs at all usually means the wrong Activity is receiving back or a legacy interception path is still present.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common failure modes and recovery steps

The manifest flag appears to do nothing

Inspect the merged manifest for the variant you installed. A product flavor, library manifest, or Activity-level declaration may override the value you edited. Uninstall the old application before reinstalling so you are not testing a stale package. Also verify that the installed package targets API 36 and that the device is actually Android 16.

Best Value
Anteel 2 Pack Silicone Suction Cup Phone Case Mount Double Sided, Hands-Free Silicon Phone Grip with Higher Suction Power for Selfies and Videos, Non Slip Phone Accessories (LightPink&White)
  • 【PKYAA Double Sided Silicone Suction Phone Case Mount】PKYAA With Double Sided 40 Strong and Reliable individual suction cups, PKYAA provides a thicken and upgraded universal silicon suction mount for your phone.
  • 【Friendly to Content Creators】If you are a content creator or an online influencer, you can create videos anywhere with this suction mount completely hands free with this silicone cell phone mount for cases.
  • 【HANDS-FREE & Adhere to Mirrors】This Double Sided silicone suction phone case mount allows you to stick your phone to the mirror easily. No longer holding your phone in one hand to watch video tutorials while making up.
  • 【Strong Grip on the Smooth Surface】You can easily hang your phone anywhere with a smooth surface. All you do is you clean off your phone and smooth surface. It is STURDY and it not only sticks to mirrors, it also sticks to windows, it sticks to refrigerators, tiles and other clean, flat surfaces.
  • 【Press Down Firmly Every 30 Minutes】Use your palm or fingers to press the phone down firmly and check it's secure before letting go. Apply even pressure for a few seconds to allow the suction cup to adhere properly. To maintain the grip and prevent accidental falls, it's a good practice to periodically reapply pressure to the suction cup.

BackHandler still never fires

Search all native source and dependencies again, including generated or vendored Android code. A custom Activity can consume the event before React Native starts. Replace its legacy override with a dispatcher callback and explicitly route the event to the React Native host. If a separate native Activity is visible, add handling there instead of on the root Activity.

The listener fires, but the app exits

Inspect every active listener’s return value. The handler must return the boolean result, not the result of a void navigation call. For example, call navigation.goBack() and then return true; do not rely on goBack() itself to produce a boolean. If no screen can go back, return false intentionally and confirm that exiting at the root is the desired product behavior.

Back works on Android 15 but not Android 16

That difference is expected when the app still depends on removed legacy dispatch. Keep the older device as a compatibility check, but make Android 16 the migration gate for target SDK 36. Do not preserve an onBackPressed() override solely because it passes on older versions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Predictive animation is missing after the fix

Check whether android:enableOnBackInvokedCallback='false' remains in the manifest or an included library. Remove the opt-out after migration, rebuild, and test both navigation modes. A dispatcher callback that is permanently enabled can also prevent the platform from reaching the intended navigation owner, so scope and lifecycle matter.

A third-party SDK still uses a legacy hook

Upgrade that SDK to a release that supports AndroidX predictive-back handling. If no compatible release exists, isolate the SDK in its own Activity where possible and apply the temporary opt-out only to that Activity. Document the exception and its removal criteria; leaving the global opt-out hides the incompatibility from future upgrades.

Choose the right fix for your project

Situation Recommended action Trade-off
Only a React Native screen has incorrect return values Correct the screen’s BackHandler listener and cleanup. Fastest change, but it cannot repair a native Activity that never forwards back.
Custom Activity or Fragment overrides onBackPressed() Migrate to AndroidX OnBackPressedDispatcher and callback lifecycle ownership. Requires native code changes; preserves predictive-back behavior.
A native component needs direct platform predictive-back control Use OnBackInvokedCallback with API guards and explicit priority/lifecycle management. Closest to the platform API, with more version-specific code to maintain.
Third-party code cannot be migrated before release Apply android:enableOnBackInvokedCallback='false' at the narrowest scope. Restores compatibility for that scope but removes predictive-back animations there.
Project is on an older React Native release Plan an upgrade, then audit custom native handling separately. Framework support improves, but private Activities and modules still need review.

The key scope decision is whether JavaScript ever receives the event. If it does, fix screen ownership and return values. If it does not, migrate the native dispatch path first. Applying the manifest opt-out globally before making that distinction can conceal both kinds of bugs.

Migration checklist

  1. Build and install the target-36 variant on Android 16.
  2. Search application code, vendored code, and dependencies for onBackPressed() and KEYCODE_BACK.
  3. Identify every Activity, Fragment, and native module that can be visible when back is pressed.
  4. Replace legacy interception with OnBackPressedDispatcher/OnBackPressedCallback, or a guarded OnBackInvokedCallback where direct platform control is justified.
  5. Route custom host callbacks through the React Native back-handler integration instead of finishing the Activity unconditionally.
  6. Register screen-level BackHandler listeners only for states that the screen actually consumes; return true after handling and false otherwise.
  7. Use android:enableOnBackInvokedCallback='false' only as a scoped, documented bridge while migration is blocked.
  8. Test gestures, three-button navigation, nested navigators, modals, root screens, lifecycle changes, and native Activities on Android 16.
  9. Remove the opt-out and rerun the matrix before declaring the migration complete.

What this means for users and release planning

The visible symptom is an app that closes when a user expects to move one level back. The underlying change is platform dispatch, not an Android 16 rule that forces every Back press to exit. A correctly integrated React Native app can continue to navigate normally, including with predictive animations, once native callbacks and JavaScript ownership agree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make Android 16 target-36 testing part of every React Native upgrade and every native SDK upgrade. Treat a passing root-screen test as insufficient: nested stacks, temporary UI state, and Activities launched by libraries are where unhandled events commonly remain. Keep the compatibility flag out of the permanent architecture, and track its removal like any other migration task.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Android 16Android developmentBackHandlerPredictive BackReact NativeTarget SDK 36

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.