Types
The React Native SDK re‑uses most of its types from @orga‑ai/core,
adding only a few mobile‑specific extensions.
React Native‑Specific Types
CameraPosition
Defines which device camera is active.
export type CameraPosition = 'front' | 'back';Used within the useOrgaAI() hook and <OrgaAICameraView> component to handle camera flipping and mirroring.
OrgaAIHookReturn (extended)
Shape of the object returned by useOrgaAI().
export interface OrgaAIHookReturn {
// Session management
startSession: (config?: SessionConfig) => Promise<void>;
endSession: () => Promise<void>;
// Media controls
enableMic: () => Promise<void>;
disableMic: (hardDisable?: boolean) => Promise<void>;
toggleMic: () => Promise<void>;
enableCamera: () => Promise<void>;
disableCamera: (hardDisable?: boolean) => Promise<void>;
toggleCamera: () => Promise<void>;
flipCamera: () => Promise<void>; // new in React Native
// State
connectionState: ConnectionState;
aiAudioStream: MediaStream | null;
userAudioStream: MediaStream | null;
userVideoStream: MediaStream | null;
conversationItems: ConversationItem[];
isCameraOn: boolean;
isMicOn: boolean;
cameraPosition: CameraPosition; // new in React Native
conversationId: string | null;
// Parameter management
model: OrgaAIModel | null;
voice: OrgaAIVoice | null;
temperature: number | null;
instructions: string | null;
modalities: Modality[];
updateParams: (params: {
model?: OrgaAIModel;
voice?: OrgaAIVoice;
temperature?: number;
instructions?: string;
modalities?: Modality[];
}) => void;
}| Field | Type | Description |
|---|---|---|
flipCamera | () => Promise<void> | Switches between front and back cameras using the native layer. |
cameraPosition | 'front' | 'back' | Indicates which camera is currently active. |
| (all other fields) | — | Identical to @orga-ai/react. |
Re‑Exported Core Types
For convenience, the React Native SDK also re‑exports the base types from @orga-ai/core:
| Type | Description |
|---|---|
ConnectionState | Connection lifecycle states. |
OrgaAIModel | Recognized model names. |
OrgaAIVoice | Supported voice presets. |
Modality | Active media modalities (e.g., audio, video). |
ConversationItem | Entries in current conversation history. |
SessionConfig | Session setup options. |
OrgaAIHookCallbacks | Optional lifecycle callbacks. |
SessionCreatedEvent, ConversationCreatedEvent | Event payloads emitted by Orga. |
DataChannelEvent, DataChannelEventTypes | Low‑level WebRTC event data and enums. |
Example Usage
import type { CameraPosition, OrgaAIHookReturn } from "@orga-ai/react-native";
import { useOrgaAI } from "@orga-ai/react-native";
export default function Example() {
const { flipCamera, cameraPosition } = useOrgaAI() as OrgaAIHookReturn;
return (
<>
<Text>Camera: {cameraPosition}</Text>
<Button title="Flip" onPress={flipCamera} />
</>
);
}Next Steps
- Hooks → Control sessions, devices, permissions, and AI interactions using
useOrgaAI(). - Components → UI primitives such as
<OrgaAICameraView>and<OrgaAIControls>for live video and media control. - Core Type Reference → TypeScript types and enums exported by the SDK, including React Native–specific additions.
Last updated on