Overview
The Suada React Native SDK provides a native mobile integration experience for both iOS and Android platforms. Built specifically for React Native, it offers platform-specific components, hooks, and utilities that follow mobile development best practices while maintaining a consistent API across platforms.Prerequisites
- React Native 0.70.0 or higher
- React 18.0.0 or higher
- Node.js 16.0.0 or higher
- A Suada API key
- iOS: Xcode 14+ (for iOS development)
- Android: Android Studio (for Android development)
Installation
Install the Suada React Native SDK and its peer dependencies:iOS Setup
Install the iOS dependencies:Android Setup
No additional setup required for Android.Quick Start
Here’s a basic example to get you started:Authentication
Setting up your API Key
We recommend storing your API key securely using react-native-config:- Install the package:
- Create environment files:
- Configure the provider:
Core Components
ChatView
A pre-built native chat interface component:Props
| Prop | Type | Required | Description |
|---|---|---|---|
| theme | ’light’ | ‘dark’ | No | UI theme (defaults to ‘light’) |
| placeholder | string | No | Input placeholder text |
| initialMessages | Message[] | No | Pre-loaded chat messages |
| privacyMode | boolean | No | Enable enhanced privacy features |
| style | ViewStyle | No | Container style |
| onMessageSubmit | (message: string) => void | Yes | Called when a message is submitted |
| onResponseReceived | (response: Response) => void | Yes | Called when a response is received |
| onError | (error: Error) => void | No | Called when an error occurs |
Integration Components
IntegrationManager
Native component for managing integrations:Hooks
useSuada
The main hook for accessing Suada functionality:Error Handling
The SDK provides platform-specific error handling:Best Practices
Security
- Store API keys securely using react-native-config
- Implement proper certificate pinning
- Use privacy mode for sensitive data
- Secure deep links for OAuth flows
Performance
- Implement proper memory management
- Use proper image caching
- Handle background/foreground transitions
- Optimize network requests
Development
- Follow React Native best practices
- Implement proper error boundaries
- Write platform-specific code when needed
- Keep dependencies updated
Platform-Specific Considerations
iOS
- Handle keyboard properly
- Implement proper permissions
- Follow Apple’s privacy guidelines
- Support dark mode correctly
Android
- Handle back button behavior
- Implement proper permissions
- Follow Material Design guidelines
- Support different screen sizes
FAQ
How do I handle deep linking for OAuth?
Configure deep linking in your app:How do I customize the native UI?
Use the theme prop and style overrides:How do I handle offline support?
The SDK includes built-in offline capabilities:How do I implement retry logic?
Configure retry behavior in the provider:How can I debug the SDK?
Enable debug mode and use the debug tools:Support & Resources
Documentation
Support
- Email Support: hello@suada.ai