import { useChannelPreviewPollLabel } from "stream-chat-react-native";
const PollPreviewLabel = ({ pollId }: { pollId: string }) => {
const label = useChannelPreviewPollLabel({ pollId });
return label ? <Text>{label}</Text> : null;
};This is beta documentation for Stream Chat React Native SDK v9. For the latest stable version, see the latest version (v8)
.
useChannelPreviewPollLabel
Builds a localized poll activity label for channel preview rows.
Best Practices
- Use this hook only when poll previews are shown in channel list items.
- Pass a stable
pollIdvalue to avoid unnecessary recomputation. - Handle empty return values when no votes are available yet.
- Rely on built-in translation output for user-facing copy consistency.
- Keep poll metadata rendering minimal in list UI.
Usage
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pollId | string | Yes | Identifier of the poll to read. |
Returns
| Type | Description |
|---|---|
string | undefined | Localized label such as You voted: Option A when data exists. |