Skip to Content
LYNKORIADocs

React Native SDK

Native media for React Native through a TurboModule and Fabric view, with messaging and push.

@lynkoria/react-native is a New Architecture library: a TurboModule (NativeLynkoria) and a Fabric component (LynkoriaVideoView) implemented on top of the native Android and iOS SDKs. It is not a WebView and does not use browser media APIs. Messaging reuses @lynkoria/client (JavaScript over React Native's native WebSocket).

Compatibility

React NativeStatus
0.88.xDevelopment target; codegen validated with 0.88.1. Not device-tested.
0.82 – 0.87Expected (New Architecture only); untested.
< 0.82 / legacy architectureNot supported.

Android: minSdk 24, Kotlin, depends on io.lynkoria:lynkoria-android. iOS: 15.1+, CocoaPods with React Native's spm_dependency pulling the Lynkoria Swift package. Expo: use a development build with the package's config plugin; Expo Go cannot load native modules.

Install

pnpm add @lynkoria/react-native
cd ios && pod install

Expo: add the config plugin and use a development build; Expo Go cannot load custom native modules.

{ "expo": { "plugins": [["@lynkoria/react-native", { "voip": true }]] } }

The plugin adds the iOS camera and microphone usage descriptions (override with cameraPermission and microphonePermission) and the audio background mode (voip with "voip": true). Android permissions and the ongoing-call service come from the library manifest.

Usage

import { createLynkoria, joinCall, LynkoriaVideoView } from '@lynkoria/react-native';

const client = createLynkoria({
  baseUrl: API_URL,
  getMessagingToken: () => backend.messagingToken(),
});
client.connect();

const call = await joinCall({ getJoinToken: () => backend.joinCall(callId), video: true });
call.onStateChange((state) => setState(state));
const people = await call.participants();
// <LynkoriaVideoView participantIdentity={people[0].identity} style={{ flex: 1 }} />
await call.leave();

joinCall asks for microphone (and camera) permission natively and fails without contacting your backend if denied. One call is active at a time.

Push and incoming calls

import { incomingCalls } from '@lynkoria/react-native';

// Android (e.g. @react-native-firebase/messaging background handler):
messaging().setBackgroundMessageHandler(async (m) => {
  incomingCalls.handlePush(m.data ?? {});
});
await client.push.register({ provider: 'fcm', token: fcmToken, appId: 'com.example.app' });

// iOS PushKit token for CallKit incoming calls:
incomingCalls.registerVoip((token) =>
  client.push.register({
    provider: 'apns_voip',
    token,
    appId: 'com.example.app',
    apnsEnvironment: 'production',
  }),
);
incomingCalls.onAction(({ callId, action }) =>
  action === 'answer' ? answer(callId) : decline(callId),
);

Verification

  • Expo config plugin: unit tests run its Info.plist modification the way prebuild does; not yet run in a real expo prebuild.
  • TypeScript API: unit tests with a mocked native module pass (permissions, join failure cleanup, state mapping, push routing).
  • Codegen: React Native 0.88.1 codegen generated the module and view interfaces from src/specs; the Kotlin overrides and iOS prop enums match the generated signatures.
  • Native code (Kotlin, Swift, Objective-C++) was not compiled, and nothing has run on an emulator, simulator or physical device. See testing completion criteria.

API reference

Every export with its signature, generated from the package build: react-native reference.

On this page