# OverlayContext

`OverlayContext` is provided by [`OverlayProvider`](/chat/docs/sdk/react-native/v8/core-components/overlay-provider/). If you are not familiar with the React Context API, see the [React docs](https://reactjs.org/docs/context.html).

## Best Practices

- Access `OverlayContext` via `useOverlayContext` for cleaner code.
- Keep overlay state centralized; avoid multiple overlay controllers in the tree.
- Use `overlay` enum values consistently to prevent unexpected UI states.
- Provide theme overrides at `OverlayProvider` when you need overlay UI to match app theme.
- Prefer context updates over direct component manipulation for overlay changes.

## Basic Usage

Consume `OverlayContext` in any child of `OverlayProvider`:

```tsx
import { useContext } from "react";
import { OverlayContext } from "stream-chat-react-native";

const { setOverlay } = useContext(OverlayContext);
```

Alternatively, use the `useOverlayContext` hook.

```tsx
import { useOverlayContext } from "stream-chat-react-native";

const { setOverlay } = useOverlayContext();
```

## Value

### `overlay`

Current active overlay. Rendered for:

- 'alert' - For delete message confirmation alert box
- 'gallery' - When image viewer/gallery is opened
- 'none' - Default value

| Type                             |
| -------------------------------- |
| enum('alert', 'gallery', 'none') |

### `setOverlay`

Setter for [`overlay`](/chat/docs/sdk/react-native/v8/contexts/overlay-context#overlay/). You can use this setter to show the overlay.

| Type                |
| ------------------- |
| `(overlay) => void` |

### `style`

A `theme` object to customize the styles of SDK components.
Detailed information on theming can be found in the [customization documentation](/chat/docs/sdk/react-native/v8/customization/theming/).

<admonition type="note">

Themes are inherited from parent providers.
A [theme provided to the `OverlayProvider`](/chat/docs/sdk/react-native/v8/core-components/overlay-provider#value/) will be the base theme `style` is merged into.
Themes are not hoisted though, therefore a theme provided to `Chat` will not change overlay components such as the attachment picker.

</admonition>

| Type   |
| ------ |
| Object |


---

This page was last updated at 2026-04-17T17:33:44.979Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react-native/v8/contexts/overlay-context/](https://getstream.io/chat/docs/sdk/react-native/v8/contexts/overlay-context/).