import { useIsChannelPinned } from "stream-chat-react-native";
const PinnedIndicator = ({ channel }: { channel: Channel }) => {
const pinned = useIsChannelPinned(channel);
return pinned ? <Text>Pinned</Text> : null;
};useIsChannelPinned
Returns whether the current user has pinned the channel and keeps it in sync with member.updated events.
Best Practices
- Use this hook instead of reading
channel.state.membership.pinned_atdirectly in render. - Read the returned
booleanfor badge and ordering decisions. - Keep pinned indicators subtle and consistent across channel previews.
- Avoid duplicating membership event listeners in custom list components.
- Handle the default unpinned state while initial membership data is syncing.
Usage
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| channel | Channel | Yes | Channel whose pinned status is observed. |
Returns
| Type | Description |
|---|---|
boolean | Whether the channel is currently pinned. |