# useMediaList

A hook that flattens a list of messages into a flat array of media tiles for the [`MediaList`](/chat/docs/sdk/react-native/ui-components/media-list/) grid. It keeps one tile per renderable image/video attachment, applying the same attachment rules the message list uses, and excludes scraped/OG link-preview attachments and non-media attachments.

## Best Practices

- Feed it the messages returned by the media search source rather than building tiles by hand.
- Render the result in a grid `FlatList`, one tile per entry.
- Expect one tile per attachment — a message with multiple media attachments yields multiple tiles.
- Keep the `messages` reference stable across renders to avoid recomputing tiles.
- Use the `message` on each tile when you need to open a gallery viewer or resolve the source message.

## Parameters

| Parameter  | Description                                           | Type                |
| ---------- | ----------------------------------------------------- | ------------------- |
| `messages` | The messages to extract image/video attachments from. | `MessageResponse[]` |

## Return type

Returns a flat array of `MediaTile`, one per image/video attachment.

### `attachment`

The image/video attachment rendered by the tile.

| Type         |
| ------------ |
| `Attachment` |

### `message`

The message the attachment belongs to.

| Type              |
| ----------------- |
| `MessageResponse` |


---

This page was last updated at 2026-06-30T12:00:26.003Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react-native/hooks/channel-details/use-media-list/](https://getstream.io/chat/docs/sdk/react-native/hooks/channel-details/use-media-list/).