React hooks exported by @alaznah/calling.
Hooks
All hooks require a parent CallingProvider.
| Hook | Returns | Use when |
|---|---|---|
useCallingClient() | CallingClient | Start / accept / end calls, media, push |
useCall() | ActiveCall | null | Current outbound / connected call focus |
useIncomingCall() | ActiveCall | null | Ringing inbound invite |
useCallQuality() | CallQualitySnapshot | null | Optional quality HUD |
useCallingReady() | boolean | Gate dialer until signaling is ready |
useWakingForCall() | boolean | Hide host chrome during kill-state / native accept wake |
There is no
useActiveCall— useuseCall().
Example
import {
useCallingClient,
useCallingReady,
useCall,
useIncomingCall,
useWakingForCall,
} from '@alaznah/calling';
export function Dialer() {
const client = useCallingClient();
const ready = useCallingReady();
const call = useCall();
const incoming = useIncomingCall();
const waking = useWakingForCall();
if (waking) return <Text>Joining call…</Text>;
if (!ready) return <Text>Connecting…</Text>;
if (incoming?.state === 'ringing') {
return (
<>
<Text>Incoming from {incoming.peerId}</Text>
{/* Prefer swipe UX in production — see Incoming Calls */}
<Button title="Accept" onPress={() => client.accept(incoming.callId)} />
<Button title="Decline" onPress={() => client.reject(incoming.callId, 'declined')} />
</>
);
}
if (call && !['ended', 'failed', 'rejected', 'missed', 'busy'].includes(call.state)) {
return (
<>
<Text>
{call.state} · {call.peerId}
</Text>
<Button title="Mute" onPress={() => client.setMuted(!call.muted)} />
<Button title="End" onPress={() => client.end()} />
</>
);
}
return (
<Button
title="Call Alice"
onPress={() => client.startCall({ calleeId: 'alice', mediaType: 'audio' })}
/>
);
}ActiveCall fields (common)
| Field | Meaning |
|---|---|
callId | Unique call id |
peerId | Other participant |
mediaType | audio or video |
direction | inbound / outbound |
state | ringing, connecting, connected, ended, … |
localStream / remoteStream | Attach to video views |
muted / videoEnabled / speakerOn | Local media flags |
torchAvailable / torchEnabled | Flash support when present |
Full type: inspect ActiveCall in the package typings.