# Thread

Component to render thread replies for a message, along with and input box for adding new thread replies. This component internally uses `MessageList` and `MessageInput` components.

## General Usage

```tsx {8}
import {
  OverlayProvider,
  Chat,
  Channel,
  Thread,
} from "stream-chat-react-native";

const App = () => {
  return (
    <OverlayProvider>
      <Chat client={client}>
        <Channel channel={channel} thread={message} threadList>
          <Thread />
        </Channel>
      </Chat>
    </OverlayProvider>
  );
};
```

## Props

### `additionalMessageInputProps`

Additional [props](https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/message-input/#props) for underlying `MessageInput` component.

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

### `additionalMessageListProps`

Additional [props](https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/message-list/#props) for underlying `MessageList` component.

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

### `autoFocus`

When true, input box will be auto focused upon mounting.

| Type    | Default |
| ------- | ------- |
| Boolean | `true`  |

### `closeThreadOnDismount`

Closes thread on dismount, defaults to `true`.

| Type    | Default |
| ------- | ------- |
| Boolean | `true`  |

### `client`

Instance of StreamChat client.

| Type                                                        |
| ----------------------------------------------------------- |
| [`StreamChat`](https://github.com/GetStream/stream-chat-js) |

### `closeThread`

Unsets the thread and thread messages in the Channel state.

| Type     |
| -------- |
| Function |

### `disabled`

When true, the underlying input box will be disabled.

| Type    | Default |
| ------- | ------- |
| Boolean | `false` |

### `loadMoreThread`

Loads more messages for the thread. Returns a promise.

| Type                  |
| --------------------- |
| `() => Promise<void>` |

### `onThreadDismount`

Function which gets called when Thread component un-mounts.

| Type     |
| -------- |
| Function |

### `parentMessagePreventPress`

Boolean to enable/disable parent message press.

| Type    | Default |
| ------- | ------- |
| Boolean | `true`  |

### `reloadthread`

Reloads the thread and thread messages.

| Type     |
| -------- |
| function |

### `thread`

Can be either a `MessageType` object or a [`ThreadType`](https://github.com/GetStream/stream-chat-react-native/blob/develop/package/src/contexts/threadContext/ThreadContext.tsx) that when set indicates a thread is open.
Both of the types may be used interchangeably.

When used with the [`Thread`](https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/thread/) component this will display the thread.
When used with the standard [`MessageList`](https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/message-list/) component this will prevent any singleton components in the [`OverlayProvider`](https://getstream.io/chat/docs/sdk/react-native/v5/core-components/overlay-provider/) form getting out of sync.

>
> **Note:** `thread` should be set on all `Channel` components when a thread is open.
>

| Type   |
| ------ |
| object |

## UI Component Props

### `MessageList`

| Type          | Default                                                                     |
| ------------- | --------------------------------------------------------------------------- |
| ComponentType | [`MessageList`](https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/message-list/) |

### `MessageInput`

| Type          | Default                                                                       |
| ------------- | ----------------------------------------------------------------------------- |
| ComponentType | [`MessageInput`](https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/message-input/) |

---

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/thread/](https://getstream.io/chat/docs/sdk/react-native/v5/ui-components/thread/).