Skip to main content

Example app

example/ is a NitroUI app that shows every status value and opens prompts. It depends on the package through the workspace (nitro-local-auth: workspace:*) and on NitroUI 0.3.0.

What it shows​

RowSource
Has hardwarehasHardware()
EnrolledisEnrolled()
Supported typesgetSupportedAuthenticationTypes()
Enrolled levelgetEnrolledLevel()
Locked outisLockedOut()
Last resultThe latest authenticate result and warning
ButtonOptions
AuthenticatepromptMessage, promptSubtitle; device fallback on
Authenticate with biometrics onlycancelLabel: 'Not now', disableDeviceFallback: true, biometricsSecurityLevel: 'strong'
RefreshReads the status values again

Run it​

From the repository root:

bun install # links the workspace and prepares the example
bun run example ios # or android

Native tests​

The example also hosts nitro-ui-harness tests in example/__tests__, which run inside the app on a simulator, emulator or device:

bun run test:ios --device "<simulator name or UDID>"
bun run test:android --device <adb-serial>

Tests that apply to one platform are named *.ios.harness.ts or *.android.harness.ts. CI runs them on an iOS simulator and an Android emulator, which have no enrolled biometrics and no passcode, so they cover the status APIs and failure paths. Check a successful prompt by hand on a device, or on a simulator with Features > Face ID > Enrolled.