React Native SDK
Add AI-powered chat support to your React Native mobile applications.
What is the Lingu SDK?
The Lingu React Native SDK provides a drop-in chat component for your mobile apps. It uses a hybrid architecture combining the flexibility of WebView for UI with native API calls for performance.
Key Features
| Feature | Description |
|---|---|
| Full-Page Chat UI | Immersive full-screen chat experience |
| Message Persistence | Conversations saved locally and restored automatically |
| Hybrid Architecture | WebView UI with native API performance |
| Easy Integration | Drop-in component for React Native apps |
| Session Management | Automatic session handling and heartbeat |
| Customizable | Full control over colors, position, and behavior |
| TypeScript | Full type safety |
| Cross-platform | Works on iOS and Android |
Architecture
The SDK uses a hybrid approach:
mermaid
flowchart TB
subgraph Mobile App
A[LinguChat Component]
B[WebView UI]
C[Native API Client]
end
D[Lingu API]
A --> B
A --> C
C --> D
D --> C
B -.-> A- WebView UI: Renders the chat interface for consistent styling
- Native API: Handles network requests for better performance
- Local Storage: Persists messages using AsyncStorage
Requirements
| Requirement | Version |
|---|---|
| React Native | ≥ 0.70 |
| iOS | ≥ 13.0 |
| Android | ≥ 21 (Android 5.0) |
Quick Start
bash
npm install @lingu/react-native-sdk react-native-webview @react-native-async-storage/async-storagetsx
import { LinguChat } from '@lingu/react-native-sdk';
<LinguChat apiKey="your-api-key-here" />Next Steps
Set up the SDK in your React Native project.
Learn how to use the LinguChat component.
Understand the hybrid architecture.