# useFileAttachmentListSections

A hook that turns a list of messages into the month-grouped sections rendered by the [`FileAttachmentList`](/chat/docs/sdk/react-native/ui-components/file-attachment-list/). It gathers the file and audio attachments from each message (excluding scraped/OG link-preview content), groups them into newest-first month sections, and skips messages without renderable file attachments.

## Best Practices

- Feed it the messages returned by the file attachment search source rather than building sections by hand.
- Render the result in a `SectionList`, using each section's `title` as the sticky month header.
- Customize the month label format through the `timestamp/FileAttachmentListSection` translation key instead of post-processing titles.
- Expect one tile per attachment — a message with multiple file attachments yields multiple rows.
- Keep the `messages` reference stable across renders to avoid recomputing sections.

## Parameters

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

## Return type

Returns an array of `FileAttachmentSection`, ordered newest-first by month.

### `title`

The localized month label for the section, used as its header.

| Type     |
| -------- |
| `string` |

### `data`

The attachment tiles in the section. Each `FileAttachmentTile` is a `{ attachment, message }` pair.

| Type                   |
| ---------------------- |
| `FileAttachmentTile[]` |


---

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

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