Example app
example/ is a NitroUI app. It wraps a gradient card, a row of color swatches and a counter in a ViewShotView. Capture cards captures them and shows the result in an overlay with its pixel size.
Run it
bun install # from the repo root: links the workspace and prepares the example
cd example
bun run nitro-ui prepare
bun run ios --device <simulator-UDID>
bun run android --device <adb-serial>
What it shows
| Part | Demonstrates |
|---|---|
ViewShotView ref={cards} | Wrapping several views to capture them together. |
capture() with isCapturing | Guarding against double taps and showing a rejection message. |
| Preview overlay | Showing the Image in NitroUI's Image with its aspect ratio. |
Captured W × H px | width and height are pixels, not points. |
Native tests
example/__tests__/ViewShot.harness.tsx runs inside the app with nitro-ui-harness. It checks pixel colors for:
- a view and its children;
- clipping children to rounded corners;
- capturing through
ViewShotView; - rejection for an empty view;
- a view with a box shadow, where
Application.supportsShadowsis true.
bun run test:ios --device "<simulator name or UDID>"
bun run test:android --device <adb-serial>