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

    Function useWaitForHost

    • Subscribe to wait-for-host state.

      When a user joins a room before the host has started it, they enter a waiting state. This hook provides the waiting status, room name, and timeout information.

      Returns {
          elapsedTime: number;
          isWaiting: boolean;
          roomName: string | null;
          timeout: number | null;
      }

      Object containing isWaiting, roomName, timeout, and elapsedTime

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

      function WaitForHostScreen() {
      const { isWaiting, roomName, timeout, elapsedTime } = useWaitForHost();

      if (!isWaiting) return null;

      return (
      <View>
      <Text>Waiting for host to start "{roomName}"</Text>
      {timeout != null && <Text>Timeout in {Math.max(0, timeout - elapsedTime)}s</Text>}
      </View>
      );
      }