Skip to main content
@neurofit/vitals-react-native is a thin wrapper: every call is forwarded to the native NeurofitVitals (Swift) or com.neurofit.vitals (Kotlin) SDK, and every event and result is marshalled to a plain JavaScript object. There is no reading logic in JavaScript. The module is TurboModule-compatible (NativeNeurofitVitals.ts) and works on the legacy bridge and, through the interop layer, on the New Architecture. React Native 0.73 or newer.
1

Install the package

The package is delivered with your license. Install it from the tarball or from your private registry.
The podspec links NeurofitVitals.xcframework from the package’s ios/Frameworks/ folder (binary license) or the Swift package sources (source license). The Android module depends on com.neurofit:vitals-sdk:1.0.0; make that artifact resolvable from mavenLocal() or your artifact repository, and set minSdkVersion to 28 or higher.
2

Platform setup

iOS: add NSCameraUsageDescription to Info.plist (see the iOS quickstart). Adding NSMotionUsageDescription as well is recommended while motionBreathing is on.Android: the wrapper’s manifest declares android.permission.CAMERA, so nothing to add. See the Android quickstart for the optional uses-feature entries.
3

Activate and check the device

A rejected promise carries code (the native error case: licenseInvalid, licenseNotValidForApp, licenseUpdatesExpired, cameraDenied, …) and message. See License keys.
4

Run a reading

createSession returns an opaque session handle. Subscribe to events before calling start; the wrapper does not buffer events. Every payload carries event and sessionId, so one set of listeners can serve several sessions if you ever need that.
In a component, start the reading in an effect and dispose in its cleanup:
NeurofitVitals.cancelReading(session, 'user_tapped_cancel') cancels the current attempt while measuring (the session returns to positioning; the call is ignored while positioning). stop(session) tears the camera down and releases the handle; it is idempotent, so a second stop resolves. A later start or cancelReading with a released handle rejects with the wrapper-level code sessionNotFound.start rejects with the native error (notActivated, alreadyRunning, cameraDenied, cameraRestricted, unsupportedDevice, on iOS also cameraUnavailable); on Android a camera that cannot be opened arrives afterwards as a failed event with code cameraUnavailable.

Foreground, orientation and screen

A reading needs the app in the foreground for the whole minute: backgrounding (iOS) or the host activity’s ON_STOP (Android) during positioning or measuring ends the session with a failed event whose error.code is interrupted. Lock the reading screen’s orientation while a session runs (an Android rotation recreates the activity) and keep the screen awake (for example with expo-keep-awake or react-native-keep-awake).

Camera preview

The camera preview is optional on every platform: a fingertip covers the lens during a reading. The V1 wrapper does not render it; show the guidance text and the live values in your own UI. A preview component is planned; see Roadmap.

API

All of these are exported as named functions and as the NeurofitVitals default export.

Event and result shapes

Event names and payload keys are shared with the Capacitor and Flutter wrappers. Every payload carries event and sessionId; every documented key is always present, with null for an absent optional.
Typed payloads are exported as StateEvent, GuidanceEvent, PreviewEvent, HeartbeatEvent, StartedEvent, CancelledEvent, ReconfiguringCameraEvent, RecoverableErrorEvent, MeasurementCompleteEvent, CompletedEvent and FailedEvent, with the VitalsEvent union and the VitalsEventPayload<Name> helper.

Next steps