airborne-react-native
v0.31.0
Published
Airborne
Readme
airborne-react-native
airborne
Installation
npm install airborne-react-nativeReact Native Airborne Implementation Summary
This implementation provides a React Native module for Airborne that:
- Initializes Airborne in native code (iOS/Android)
- Provides React Native methods to access the native Airborne instance
- Is compatible with both old and new React Native architectures
Key Features
Native Initialization
- Airborne should be initialized once in native code when the app starts
- The instance should be created before React Native initializes
- This ensures the Airborne instance is ready when React Native needs it
Architecture Compatibility
- Old Architecture: Uses traditional React Native bridge (
AirborneModule) - New Architecture: Uses TurboModules with JSI (
AirborneTurboModule) - Automatically detects and uses the appropriate implementation
Shared Implementation
- Android uses
AirborneModuleImplto share logic between architectures - iOS uses
AirborneiOSwrapper to manage the native instance - Both platforms follow the same initialization pattern
File Structure
Android
Airborne.kt- Integration class for Airborne SDKAirborneInterface.kt- The interface that has to be implemented by the consumer for providing all the necessary integration params.AirborneModuleImpl.kt- Shared implementation logicAirborneModule.kt- Old architecture moduleAirborneTurboModule.kt- New architecture moduleNativeAirborneSpec.java- TurboModule spec
iOS
AirborneiOS.h/m- Integration class for Airborne SDKAirborne.h/mm- React Native module implementation- Supports both architectures with conditional compilation
JavaScript/TypeScript
NativeAirborne.ts- TurboModule TypeScript specindex.tsx- Module exports with architecture detection
API Methods
- readReleaseConfig(namespace/appId) - Returns the release configuration as a stringified JSON
- getFileContent(namespace/appId, filePath) - Reads content from a file in the OTA bundle
- getBundlePath(namespace/appId) - Returns the path to the JavaScript bundle
Usage
Native Initialization
React Native Usage
import { readReleaseConfig, getFileContent, getBundlePath } from 'airborne-react-native';
// Read configuration
const config = await readReleaseConfig(namespace/appId);
// Get file content
const content = await getFileContent(namespace/appId, 'path/to/file.json');
// Get bundle path
const bundlePath = await getBundlePath(namespace/appId);Implementation Notes
- Thread Safety: Both Android and iOS implementations are thread-safe
- Error Handling: All methods return promises that reject with descriptive errors
- Placeholder Implementation: The iOS implementation includes placeholders for the actual Airborne SDK integration
Next Steps
To complete the integration:
- Implement additional Airborne features as needed
- Add event emitters for callbacks if required
Testing
The example app demonstrates:
- Native initialization in MainApplication/AppDelegate
- Using all three API methods
- Status indicator showing initialization state
- Error handling for failed operations
