Hiyve Components - v1.0.0
    Preparing search index...

    Function useParticipants

    • Access all participants in the current room.

      Provides participants as both an array (for rendering lists) and a Map (for direct lookup by user ID), along with the total count and the local user's ID.

      Returns {
          localUserId: string | null;
          participantCount: number;
          participants: Participant[];
          participantsMap: Map<string, Participant>;
      }

      Object containing participants array, participantsMap for direct lookup, localUserId, and participantCount

      import { useParticipants } from '@hiyve/rn-react';

      function ParticipantCount() {
      const { participants, participantCount, localUserId } = useParticipants();

      return (
      <View>
      <Text>{participantCount} participants</Text>
      <FlatList
      data={participants}
      renderItem={({ item }) => (
      <Text>{item.displayName}{item.odvisitors === localUserId ? ' (You)' : ''}</Text>
      )}
      />
      </View>
      );
      }