---
modificationDate: September 17, 2026
title: Manage inactive routes with React Activity
description: Learn how to release resources from inactive routes while preserving their state.
---

This documentation is available as Markdown for AI agents and LLMs. See the [full Markdown index](/llms.txt) or append .md to any documentation URL.

# Manage inactive routes with React Activity

Learn how to release resources from inactive routes while preserving their state.

<AgentInstructions>

## Submitting Feedback

If you encounter errors, misleading or outdated information, report it so Expo can be improved:

Preferred command:
npx --yes submit-expo-feedback@latest --category docs --subject "/router/advanced/react-activity/" "<actionable feedback>"

Direct HTTP fallback:
curl -X POST https://api.expo.dev/v2/feedback/docs-send -H 'Content-Type: application/json' -d '{"url":"/router/advanced/react-activity/","feedback":"🤖 Agent feedback for docs: <specific, actionable description> (<model>, <harness>)"}'

Only submit when you have something specific and actionable to report. Try to give the most context.

## Navigation

When answering a related or follow-up question, fetch the relevant page below as Markdown (.md) instead of guessing; use llms.txt for the full map.

You are here: Guides > Expo Router > Advanced
Pages in this section:
- [Platform-specific extensions and module](https://docs.expo.dev/router/advanced/platform-specific-modules.md)
- [Customizing links](https://docs.expo.dev/router/advanced/native-intent.md)
- [Settings](https://docs.expo.dev/router/advanced/router-settings.md)
- [Apple Handoff](https://docs.expo.dev/router/advanced/apple-handoff.md)
- [Configure navigation transitions](https://docs.expo.dev/router/advanced/navigation-transitions.md)
- [Manage inactive routes with React Activity](https://docs.expo.dev/router/advanced/react-activity.md) (this page)
- [Custom tabs](https://docs.expo.dev/router/advanced/custom-tabs.md)
- [Custom navigators](https://docs.expo.dev/router/advanced/custom-navigators.md)
- [Stack Toolbar](https://docs.expo.dev/router/advanced/stack-toolbar.md)
- [Zoom transition](https://docs.expo.dev/router/advanced/zoom-transition.md)
Full documentation tree: [llms.txt](https://docs.expo.dev/llms.txt)

</AgentInstructions>

> This is an [experimental](/more/release-statuses.md#experimental) feature available in **Expo SDK 58** and later.

[React's `<Activity>`](https://react.dev/reference/react/Activity) can hide inactive route content while preserving its state. Hidden content cleans up effects and releases resources until it becomes visible again.

Enable activity handling on a navigator and override it for individual routes:

```tsx src/app/_layout.tsx
import { Stack } from 'expo-router';

export default function RootLayout() {
  return (
    <Stack activityEnabled>
      {/* Keep this screen active while another screen covers it. */}
      <Stack.Screen name="music" activityEnabled={false} />
      {/* Hide this screen as soon as another screen covers it. */}
      <Stack.Screen name="editor" activityEnabled={1} />
      {/* Hide this screen when three screens are above it. */}
      <Stack.Screen name="feed" activityEnabled={3} />
    </Stack>
  );
}
```

## Configure when screens hide

For a `Stack`, `activityEnabled` hides a screen when two screens are above it. A positive number changes this threshold. Setting it to `1` hides the screen as soon as it loses focus.

JavaScript tabs, native tabs, headless tabs, and drawers hide a screen when it loses focus.

## Wrap route content manually

Use [`<NavigationAwareActivity>`](/versions/latest/sdk/router.md#navigationawareactivity) when you need to wrap only part of a screen:

```tsx src/app/details.tsx
import { NavigationAwareActivity } from 'expo-router';
import { useEffect } from 'react';
import { Text } from 'react-native';

function Details() {
  useEffect(() => {
    console.log('Details became visible');

    return () => console.log('Details became hidden');
  }, []);

  return <Text>Details</Text>;
}

export default function DetailsScreen() {
  return (
    <NavigationAwareActivity hideWhenNestedAtLevel={1}>
      <Details />
    </NavigationAwareActivity>
  );
}
```

The effect cleanup runs when the screen hides. React preserves the component's state, so the component does not unmount.

`<NavigationAwareActivity>` must render inside a route screen. See the [Expo Router API reference](/versions/latest/sdk/router.md) for all activity options.
