Skip to main content

Example app

example/ is a NitroUI app that shows every value the package reads, on one scrolling screen:

  • every DeviceDetails field, read once with useState(() => DeviceInfo.getDeviceDetails());
  • the power state, kept current with addOnPowerStateChangedListener in an effect;
  • used memory, font scale, vendor ID, headphones and passcode, re-read by a Refresh button;
  • whether location is enabled and the user agent, resolved from their promises.

Run it​

From the repo root:

bun install # links the workspace, generates bindings and prepares the example
bun run example ios # or: bun run example android

Native harness tests​

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

bun run test:ios --device "<simulator name or UDID>"
bun run test:android --device <adb-serial>
FileCovers
DeviceInfo.harness.tsBoth platforms: details, caching, power, listener removal, memory, font scale, vendor ID, user agent, location.
DeviceInfo.ios.harness.tsiOS only.
DeviceInfo.android.harness.tsAndroid only.

CI builds the example and runs these tests on an iOS simulator and an Android emulator.