Prerequisites
- React Native
0.81.5with React19.1.x, or Expo SDK 54 - New Architecture enabled
- Node 20.19.4 or later
- A physical arm64 iOS or
arm64-v8aAndroid device - Android API 24 or later for the React Native host
- iOS 15 or later
- A Nosmai licence key for each native identity
- The verified Android AAR and iOS CocoaPod used by the package
The React Native package is public on npm under the latest tag. Expo Go cannot load its TurboModule or Fabric component, so Expo projects require a custom development or release build.
Add the package
Install the current stable release from npm:
yarn add @nosmai/react-native-effects-sdk
Use the exact version when the application must stay on this qualified release:
yarn add @nosmai/[email protected]
Commit the resulting lockfile. Do not depend on an unpinned moving Git branch in a production application.
Configure a bare React Native Android app
Download and verify the Android 3.0.4 AAR. Put exactly one copy here:
Download the verified Android v3.0.4 release.
android/app/libs/nosmai-release.aar
Configure the app module:
android {
defaultConfig {
minSdkVersion 24
ndk {
abiFilters 'arm64-v8a'
}
}
}
dependencies {
implementation files('libs/nosmai-release.aar')
}
Keep New Architecture enabled in android/gradle.properties:
newArchEnabled=true
The library manifest declares camera, internet, recording audio, and the legacy write permission limited to API 28. The host app still requests camera and microphone permission at runtime.
Configure a bare React Native iOS app
The package pod depends on NosmaiCameraSDK ~> 3.0.4 and resolves the verified native SDK 3.0.4 framework. It does not vendor a framework.
Add these keys to the host application's Info.plist:
<key>NSCameraUsageDescription</key> <string>This app uses the camera for real-time filters and effects.</string> <key>NSMicrophoneUsageDescription</key> <string>This app uses the microphone when recording video.</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>This app saves captured photos and videos to your library.</string>
Install pods:
cd ios bundle exec pod install cd ..
The iOS framework is device-only. Select a physical arm64 iPhone for runtime verification.
Configure Expo SDK 54
Keep the proprietary Android AAR outside the generated android directory, for example at vendor/nosmai-release.aar. Add the config plugin:
export default {
expo: {
newArchEnabled: true,
plugins: [
[
'@nosmai/react-native-effects-sdk',
{
androidAarPath: './vendor/nosmai-release.aar',
androidAarSha256: process.env.NOSMAI_ANDROID_AAR_SHA256,
cameraPermission:
'Allow this app to use the camera for Nosmai effects.',
microphonePermission:
'Allow this app to use the microphone when recording video.',
photoLibraryAddPermission:
'Allow this app to save captured photos and videos.',
},
],
],
},
};
Create a custom development build:
npx expo install expo-dev-client npx expo prebuild --clean npx expo run:android
For iOS, use a physical device:
npx expo run:ios --device
expo prebuild --clean recreates native directories. Keep the source AAR in a stable vendor location and preserve unrelated manual native changes before running it.
Package size
The 1.0.0 npm package is about 226.1 kB packed and 1.1 MB unpacked. It contains JavaScript, TypeScript declarations, the Fabric view, native bridges, and an Expo config plugin. It excludes the proprietary Android AAR and iOS framework. Native size impact therefore follows the Android and iOS artifacts rather than the JavaScript archive alone.
Verify it worked
Run the package and TypeScript checks in the host app, then build a native target:
yarn typecheck yarn android
or build iOS from the workspace for a physical device. Confirm that importing both symbols compiles:
import {
NosmaiCameraSdk,
NosmaiCameraView,
} from '@nosmai/react-native-effects-sdk';
Continue to the React Native quickstart to request permission, mount the Fabric view, initialize, and start processing.
Common errors
| Error | Cause | Fix |
|---|---|---|
Cannot find native module 'NosmaiCameraSdk' | App is running in Expo Go or native code was not rebuilt | Use an Expo development build or rebuild the bare native application |
E_NOT_INITIALIZED | A camera or effect method ran before initialization | Await NosmaiCameraSdk.initialize before starting processing |
E_NO_PREVIEW | The Fabric view was not mounted before processing started | Mount NosmaiCameraView, wait for layout, then call startProcessing |
E_CAMERA_PERMISSION | Android host did not grant runtime camera access | Request PermissionsAndroid.PERMISSIONS.CAMERA before startup |
INSTALL_FAILED_NO_MATCHING_ABIS | Android target lacks arm64-v8a | Use a physical ARM64 device and keep the ABI filter |
building for iOS Simulator, but linking in object file built for iOS | Simulator was selected | Run the native build on a physical iPhone |
Next steps
- Add real-time camera effects to a React Native app
- Get and apply a licence key
- Control a camera game in React Native
- Check React Native capabilities
- Apply a beauty filter in React Native