React Native SDK
Embed the Talkmoji talking agent in your iOS and Android app using a WebView-based component. Works with Expo (managed and bare) and bare React Native.
Installation
npm install @avatar-platform/react-native react-native-webview
# or
expo install @avatar-platform/react-native react-native-webview
The SDK depends on react-native-webview for rendering the Rive character and Gemini Live audio. Expo Go does not include react-native-webview — use a development build or bare workflow.
How it works
The React Native SDK embeds a WebView that points to the same /embed/:publicId page used by the web widget. Rive runs inside the WebView using its HTML5 canvas renderer, and audio is handled by the browser engine inside the WebView.
This approach means:
- No native modules to link beyond
react-native-webview - The character, lip sync, and Gemini Live features are identical to the web
- Rive animations run at 60fps on modern iOS and Android devices
- Microphone access is requested via the WebView's built-in permission system
Basic usage
import { AvatarWidget } from '@avatar-platform/react-native';
export default function HomeScreen() {
return (
<View style={{ flex: 1 }}>
<YourContent />
{/* Floating overlay widget */}
<AvatarWidget
botId="YOUR_BOT_ID"
serverUrl="https://your-deployment.com"
style={{ position: 'absolute', bottom: 20, right: 20, width: 72, height: 72 }}
/>
</View>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| botId | string | — | Required. The public ID of your project. |
| serverUrl | string | — | Required. Base URL of your Talkmoji deployment (no trailing slash). |
| style | ViewStyle | — | Style for the container View. Position it yourself (e.g. position: 'absolute') the same way you'd position any floating RN element. Defaults to filling its parent. |
There's no position/theme/startOpen prop — those are configured per-project in your Talkmoji dashboard's Widget settings, not overridable per-mount. Size and placement of the WebView itself is entirely up to your own style.
Platform notes
iOS
- Add
NSMicrophoneUsageDescriptionto yourInfo.plist— the WebView will request mic access for Gemini Live voice chat. - In Expo, add the
expo-permissionsplugin or setinfoPlist.NSMicrophoneUsageDescriptioninapp.json. - Requires iOS 14+ for WebRTC support inside WKWebView.
<!-- iOS Info.plist -->
<key>NSMicrophoneUsageDescription</key>
<string>The AI assistant needs your microphone to respond by voice.</string>
Android
- Add the
RECORD_AUDIOpermission toAndroidManifest.xml. - The WebView uses
android.webkit.PermissionRequestto surface the mic prompt to the user. - Requires Android 7.0+ (API 24).
<!-- android/app/src/main/AndroidManifest.xml -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
Async Q&A (no WebView)
For headless integrations — asking questions without showing the animated character — use the async API directly:
import { askAvatar } from '@avatar-platform/react-native';
const result = await askAvatar({
serverUrl: 'https://your-deployment.com',
botId: 'YOUR_BOT_ID',
question: 'What payment methods do you accept?',
});
console.log(result.answer); // text answer
console.log(result.sources); // source citations
This calls POST /embed/:publicId/ask over HTTPS — no WebView, no audio, no Rive. Useful for search bars, chatbots, and in-app FAQ flows.
Expo Go limitation: The full AvatarWidget component (with Rive + audio) requires a custom dev client or production build. The askAvatar async helper works in Expo Go since it only uses fetch.