# CreatePoll

A component used to render the entirety of the poll creation form. It encapsulates the `CreatePollContent` component within a [`CreatePollContext`](/chat/docs/sdk/react-native/v8/contexts/create-poll-context/). Needs to be structured inside a [`Channel` component](/chat/docs/sdk/react-native/v8/core-components/channel/).

The default behaviour of this component is it opening in a [React Native Modal](https://reactnative.dev/docs/modal). Integrators are highly encouraged to write their own UI for the dialog with the specific options and flexibility they require.

## Best Practices

- Render `CreatePoll` inside `Channel` so context and send hooks are available.
- Provide a custom dialog UI if you need full control over UX.
- Call `closePollCreationDialog` to cleanly dismiss the modal.
- Validate poll options before calling `sendMessage`.
- Keep poll creation UI lightweight to avoid input lag.

## General Usage

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

const App = () => {
  return (
    <OverlayProvider>
      <Chat client={client}>
        <Channel channel={channel}>
          <CreatePoll sendMessage={sendMessage} {...otherOptionalProps} />
        </Channel>
      </Chat>
    </OverlayProvider>
  );
};
```

## Props

### sendMessage

Sends a composed message within `MessageInput` component to channel. This function is attached to `onPress` handler of [`SendButton`](/chat/docs/sdk/react-native/v8/core-components/channel#sendbutton/). The message optimistically gets added to message list UI first, before actually making API call to server.
During this intermediate stage, MessageStatus component will display an indicator for "pending" state.

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

The function takes an object as a parameter with the following properties:

| Parameter      | Description                                                        |
| -------------- | ------------------------------------------------------------------ |
| `localMessage` | Contains the message data that will be shown in the UI immediately |
| `message`      | Contains the data that will be sent to the backend                 |
| `options`      | Contains options for sending/updating the message                  |


### `closePollCreationDialog`

A method that will be used as a callback whenever the default `CreatePoll` component back button is pressed in the header. Unless used, it will have no effect if the default `CreatePollContent` is overridden.

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

### `onThreadSelect`

A property used to define the height of the poll options in the `CreatePollContent` draggable list. The items can have a constant and equal height only and this should only be used if custom theming implies that the static height of the items changes. Has no effect if a custom UI for `CreatePollContent` is provided.

| Type   |
| ------ |
| number |

### `CreatePollContent`

A custom UI component used to render the entire poll creation form. It has access to the [`CreatePollContext`](/chat/docs/sdk/react-native/v8/contexts/create-poll-context/) values by default through the `useCreatePollContext` hook.

| Type          | Default                                                                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| ComponentType | [`CreatePollContent`](https://github.com/GetStream/stream-chat-react-native/v8/blob/main/package/src/components/Poll/CreatePollContent.tsx) |



---

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

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