Fix React Native SDK issues
React Native introduces extra moving parts—native modules, permissions, and physical devices. Use the sections below to match a symptom to the fix.
SDK not initialized
Error
OrgaAI must be initialized before use. Call OrgaAI.init() first.Fix
app/_layout.tsx
import { OrgaAI, OrgaAIProvider } from '@orga-ai/react-native';
OrgaAI.init({
fetchSessionConfig: async () => {
const res = await fetch('https://api.yourdomain.com/orga-client-secrets');
return res.json();
},
model: 'orga-1-beta',
voice: 'alloy',
});
export default function RootLayout() {
return (
<OrgaAIProvider>
<Stack />
</OrgaAIProvider>
);
}Hook used outside provider
Error
useOrgaAI must be used within an OrgaAIProviderFix – Wrap your navigator (Stack, Tabs, etc.) inside <OrgaAIProvider> in app/_layout.tsx.
Missing native dependencies
Error
Cannot find module 'react-native-webrtc' or 'react-native-incall-manager'Fix
npm install @orga-ai/react-native react-native-webrtc react-native-incall-manager
npx expo prebuild
eas build --profile developmentFor bare RN, run npx pod-install after yarn/npm install.
Camera or microphone unavailable
| Cause | Fix |
|---|---|
| Permissions missing | Add camera/mic strings to app.json (NSCameraUsageDescription, NSMicrophoneUsageDescription, Android android.permission.CAMERA, android.permission.RECORD_AUDIO). Rebuild the dev client. |
| Using Expo Go | Build an Expo development client. Expo Go lacks the required native modules. |
| Simulator limitations | Test on a physical device for real camera/mic access. |
| User denied access | Prompt again or direct users to system settings to re-enable. |
Connection fails after startSession()
- Verify your backend proxy returns both fields:
curl https://api.yourdomain.com/orga-client-secrets{ "ephemeralToken": "...", "iceServers": [...] }- Confirm your proxy calls both
/v1/realtime/client-secretsand/v1/realtime/ice-config. - Update to the latest server SDK and ensure your API key is valid.
“Device not supported” during build
- Minimum React Native version: 0.72+
- Minimum Expo SDK: 50+
- Build with:
npx expo prebuild
eas build --profile developmentNo audio playback
- Ensure
react-native-incall-manageris installed and linked. - Force speaker output when needed:
import InCallManager from 'react-native-incall-manager';
InCallManager.setSpeakerphoneOn(true);- Test with wired/Bluetooth audio; some Android devices default to earpiece mode.
Missing environment variables
If your proxy returns 401/500, verify the server has:
ORGA_API_KEY=sk_orga_ai_******************************Run with logLevel: 'debug' in OrgaAI.init() and watch expo start --dev-client logs for ICE negotiation steps.
Last updated on