VitalsReadingFlow is a complete, full-screen reading in the style of the NEUROFIT app, with the same screens,
strings and colours on iOS, Android (Jetpack Compose), React Native and Flutter. Present it with your quickstart’s
Option A (iOS,
Android,
React Native,
Flutter). Capacitor has no pre-built flow.
The default light theme on the iOS Simulator, with a flat colour standing in for the camera.
Screens
After a cancel, the flow returns to positioning with a short note in the card, and the next reading starts by
itself. If the paused screen or the tips stay open for 2 minutes, the flow turns the camera and torch off and lets
the screen lock until the user continues.
Callbacks
Exactly one callback fires per presentation, when the user leaves the flow. The flow then keeps showing its last screen, frozen, until you remove it. The SwiftUI modifier and the Android Activity dismiss themselves.
Removing the flow before then (your navigation, an iOS swipe back) stops the session and calls nothing. The flow
never calls
activate: without it the flow says vitals measurement is unavailable and ends with onError
(notActivated).
System back closes the tips first, then leaves like the close button. In a React Native Modal on Android, forward
the Modal’s back with onRequestClose={() => flowRef.current?.back()}. In Flutter the flow handles back itself, so
the iOS swipe back is off while it shows.
Options
The flow reads
showTips and showResults once, when it appears. In Swift the four follow the callbacks:
showResults:, showTips:, theme:, strings:. React Native also takes safeAreaInsets to set the insets
yourself, for example in a Modal with statusBarTranslucent in an Android app that does not draw edge to edge.
The Android Activity takes the four as VitalsReadingFlowOptions (Kotlin DSL or Java Builder) and returns a
VitalsReadingFlowResult: Completed(result), Cancelled or Failed(error). The options travel in the Intent, so
the theme uses plain Int colours, dp Floats and a font resource id.
Presenting the flow
- Full screen, with no navigation header (the flow draws its own). iOS:
.vitalsReadingFlow(isPresented:...)orVitalsReadingFlowViewController, not afullScreenCover, which cannot lock the orientation. Android:VitalsReadingFlowActivitythroughVitalsReadingFlowContract, or a composable destination with no app bar. React Native: aModalor a header-less screen. Flutter: a route with no app bar. - Which entry points lock portrait: Orientation and screen.
- Android: the Activity handles rotation, resizing, dark mode and text size itself, and starts over if the process dies in the background. The composable locks portrait only, and large screens may ignore that lock: a configuration change that recreates your activity (a rotation or resize, dark mode, font scale) stops the reading. Use the Activity unless your activity handles those.
- One flow at a time: the flow runs one session.
- Collect any consent your app needs before you show the flow. The flow explains the camera, not your handling of results.
Camera preview
VitalsCameraPreview shows the session’s camera: its previewLayer on iOS, a CameraX PreviewView the session
binds at start() on Android. The flow mounts it before start() and keeps it until the reading ends. In your own
layout:
- Mount the preview, wait for its
onReady, then callstart(). On iOS the order does not matter:previewLayerexists frominit. If the preview never reports ready, the flow starts after 1.5 seconds without one. - Natively, iOS takes the layer (
VitalsCameraPreview(previewLayer: session.previewLayer, onReady:), or the UIKitVitalsCameraPreviewView), and on AndroidonReadyhands you thePreviewViewforsession.start(lifecycleOwner, previewView). In React Native and Flutter the wrapper connects it for you. - One preview shows the camera at a time: the last one mounted.
- It keeps the screen awake while it shows, and screen readers skip it (a fingertip covers the lens).
Theme
Override any colour, the font and the corner radii, for light and dark separately, starting fromVitalsTheme():
- iOS
- Android
- React Native
- Flutter
The bundled Jost needs no setup and never replaces a font your app calls
Jost (React Native registers it on
Android as NeurofitVitalsJost). On iOS, if your app already has a font with Jost’s names, the native flow uses
yours and the React Native flow uses the system font.
The default text and signal colours meet WCAG AA contrast over the camera preview. If you change them, check the
contrast in both appearances.
Colour tokens
Colour tokens
Strings
The flow ships in English: override every string to localize.VitalsStrings() gives the English defaults. They
are also the suggested copy for your own screens: guidanceText returns the text the flow shows for a guidance
value, and cancelNotice the note for a cancel reason (none for interrupted and cancelledByApp).
- iOS
- Android
- React Native
- Flutter
{value} and {seconds}. Every phone gets the same six tips, light first: tipLight, tipCover,
tipWarm, tipRest, tipStill and tipCase, on the tips screen and the paused screen. On a phone without a torch,
each key ending in NoTorch replaces the key above it, and the flow adds the bright-light screen (noTorchHeading,
noTorchBody).
All 78 strings (English defaults)
All 78 strings (English defaults)
Accessibility
Every control and value has a screen-reader label, with units spoken in full. Focus moves to each new screen’s heading. The guidance, notes, a reading starting and checking are announced on iOS and read from a polite live region on Android. Text follows the system text size within a limit per element. Reduce Motion on iOS, or Remove animations on Android, turns the animations off.Building blocks
For your own layout, the flow’s pieces are exported:VitalsCameraPreview, VitalsProgressRing,
VitalsGuidanceCard, VitalsSignalIndicator, VitalsLiveStrip and VitalsResultsCard, plus
VitalsCameraPreviewView for UIKit. They are SwiftUI views on iOS, composables on Android, components in React
Native and widgets in Flutter. Each takes the same theme and, where it shows text, the same strings. Each carries
this note: “Building block of the reading flow: its parameters and appearance may change in minor releases.”
VitalsSignalIndicator (quality) and VitalsLiveStrip (signalQuality) take the preview’s signalQuality as
is: a LiveSignalQuality, or nil (null) before the first scored preview. They show the score as a percentage
(signalPercent) with the label under it in the label’s colour, and the placeholder until then.