A modern, user-friendly messaging application built with the Offline Protocol SDK. This app demonstrates peer-to-peer messaging capabilities without requiring internet connectivity.
- Beautiful UI: Modern, responsive design with smooth animations
- User-Friendly Onboarding: Guided setup process for new users
- Dark/Light Theme: Automatic theme switching with system preferences
- Responsive Design: Optimized for phones and tablets
- Real-time Chat: Send and receive messages instantly
- Message Priorities: High, medium, and low priority messaging
- Chat Management: Organized conversations with unread indicators
- Message Status: Delivery confirmations and status tracking
- Automatic Discovery: Find nearby devices automatically
- Contact Management: View online status and signal strength
- Distance Indicators: Visual representation of peer proximity
- Profile Views: Detailed contact information and chat statistics
- Network Health: Real-time network performance monitoring
- Usage Statistics: Message counts, response times, and activity tracking
- Recent Activity: Timeline of network events and messages
- Performance Metrics: Comprehensive analytics with visual indicators
- Profile Management: Customizable user names and preferences
- Theme Selection: Light, dark, or system theme options
- Notification Controls: Granular notification preferences
- Protocol Settings: Advanced configuration options
- Dynamic Routing Controls: Toggle offline-only vs hybrid mode and tune DORS thresholds live
- React Navigation 7: Tab and stack navigation with smooth transitions
- React Native Reanimated 3: High-performance animations and gestures
- TypeScript: Full type safety throughout the application
- Context API: State management with React Context and hooks
- Theme System: Comprehensive theming with light/dark mode support
- Responsive Design: Adaptive layouts for different screen sizes
- Animation System: Consistent animations and micro-interactions
- Icon System: Vector icons with consistent styling
- Protocol Provider: Centralized offline protocol state management
- Theme Provider: Theme and appearance management
- Custom Hooks: Reusable logic for protocol and UI interactions
- Node.js 18 or higher
- React Native development environment
- iOS Simulator or Android Emulator
- Physical devices for testing peer-to-peer functionality
The Rust native libraries must be built before the first run — the app fails to load the native module otherwise. See SETUP.md for the full first-time setup.
-
Build Native Libraries (required before first run)
Needs
uniffi-bindgenat the crate's pinned version — the build regenerates the UniFFI bindings alongside the native libraries and refuses to run on a mismatch:cargo install uniffi --version 0.30.0 --features cli --locked.cd ../../bindings/react-native npm run build:all cd ../../examples/react-native-app
-
Install Dependencies
npm install
-
iOS Setup
cd ios pod install cd ..
-
Run the App
# iOS npm run ios # Android npm run android
-
Start Metro Bundler
npm start
-
Run on Device
- For best experience, run on physical devices
- Enable Bluetooth permissions
- Test with multiple devices for peer-to-peer functionality
- Onboarding: Complete the guided setup process
- Choose Name: Select a display name for other users
- Permissions: Grant necessary Bluetooth permissions
- Start Messaging: Begin discovering nearby devices
- Discovery: Nearby devices appear in the Contacts tab
- Start Chat: Tap a contact to begin messaging
- Send Messages: Choose priority level and send messages
- View Chats: Access all conversations in the Chats tab
- Monitor Performance: View network health and statistics
- Track Usage: See message counts and response times
- Recent Activity: Review connection events and message history
- Customize Profile: Change display name and preferences
- Theme Options: Switch between light, dark, or system themes
- Notifications: Configure message notifications and sounds
- Automatic Transport Management: BLE and WiFi Direct handled automatically
- Message Routing: Intelligent message routing through mesh network
- Connection Management: Automatic peer discovery and connection handling
- Store-and-Forward Queue: Messages automatically queued and retried when peers return
- Live Metrics: Inspect transport queue depth, retry counters, and energy hints from the SDK
- Error Handling: Comprehensive error handling and recovery
- Lazy Loading: Components loaded on demand
- Memoization: Optimized re-rendering with React.memo and useMemo
- Virtual Lists: Efficient rendering of large message lists
- Image Optimization: Optimized avatar and icon rendering
- End-to-End Encryption: All messages encrypted in transit
- No Data Collection: No personal data sent to external servers
- Local Storage: All data stored locally on device
- Privacy First: Designed with privacy as the primary concern
The app uses a comprehensive theme system that can be easily customized:
// Custom theme colors
const customTheme = {
colors: {
primary: '#007AFF',
secondary: '#5856D6',
// ... other colors
}
};Animations can be customized using the animation utilities:
import { ANIMATION_PRESETS } from '../utils/animations';
// Custom entrance animation
const customAnimation = ANIMATION_PRESETS.fadeIn(500);The app automatically adapts to different screen sizes using responsive utilities:
import { getResponsiveValue } from '../utils/responsive';
const fontSize = getResponsiveValue({
xs: 14,
md: 16,
lg: 18,
}, 16);npm test- Test on multiple physical devices
- Verify peer-to-peer messaging functionality
- Test offline scenarios and network switching
- Monitor memory usage during extended use
- Test with large message histories
- Verify smooth animations on lower-end devices
-
Bluetooth Permissions
- Ensure Bluetooth permissions are granted
- Check system Bluetooth settings
-
Device Discovery
- Verify devices are in range (typically 10-100 meters)
- Ensure both devices have the app running
-
Message Delivery
- Check network connectivity indicators
- Verify recipient device is online
-
Performance Issues
- Restart the app if experiencing lag
- Clear message history if needed
Enable debug logging in development:
// In development
if (__DEV__) {
console.log('Debug information');
}- Follow the existing code style and patterns
- Add comprehensive TypeScript types
- Include appropriate animations and responsive design
- Test on multiple devices and screen sizes
- Update documentation for new features
This example app is part of the Offline Protocol SDK and follows the same licensing terms.
- Modern, clean interface with intuitive navigation
- Smooth animations and micro-interactions
- Comprehensive messaging features
- Elegant dark mode with proper contrast
- Consistent theming throughout the app
- Eye-friendly for low-light usage
- Optimized for phones and tablets
- Adaptive layouts for different screen sizes
- Consistent experience across devices