PollContext

The PollContext is provided by the Poll component. If you are not familiar with React Context API, please read about it on React docs.

The PollContext needs to be used within the Channel component as it depends on various values provided by it in order to work.

Basic Usage

The PollContext can be consumed by any of the child components of Channel as following:

import { useContext } from "react";
import { CreatePollContext } from "stream-chat-react-native";

const value = useContext(PollContext);

Alternatively, you can also use the usePollContext hook provided by library to consume PollContext.

import { usePollContext } from "stream-chat-react-native";

const value = usePollContext();

Value

message

Message object.

Type
Message type

poll *

An instance of the Poll class containing reactive state.

It is used by the underlying usePollContext, usePollStateStore and usePollState hooks to provide us with the reactive Poll state.

If you need the Poll instance you may get it from client.polls.fromState(pollId).

Type
object

© Getstream.io, Inc. All Rights Reserved.