React Native
Dimensioning (React Native)
Platform support: iOS 17+ with LiDAR (device-only). Dimensioning is iOS-only - Android shows a placeholder and does not emit capture events.
Requires the upcoming release. overlayMode, onMeasurementUpdate, onOverlayUpdate, onTelemetry, the cloud credential props and the stop() / start() commands land with iOS VisionSDK 2.7.0 support. On earlier react-native-vision-sdk versions those props are ignored. See the release notes.
This guide documents the React Native surface for the Vision SDK's 3D box dimensioning feature. It covers integration, usage, gating, live guidance, custom overlays, telemetry, troubleshooting, and known limitations.
Contents
- Quick overview
- Installation & permissions
- Device capability gating
VisionDimensioninghelpersDimensioningViewprops, events and commands- Live guidance and custom overlays
- Telemetry
- Cloud segmentation
- Troubleshooting
- Known limitations
- Source references
Quick overview
- Dimensioning provides approximate length × width × height measurements for detected boxes using ARKit + LiDAR and optional cloud segmentation refinement (YOLO + SAM2).
- The React Native package exposes:
DimensioningView- native view component emittingonCapture,onError,onMeasurementUpdate,onOverlayUpdateandonTelemetry(iOS only), plusstop()/start()through a ref.VisionDimensioning.deviceCapabilities()- inspect device support.VisionDimensioning.prefetchModels()- warm the bundled CoreML models.
Always gate UI with deviceCapabilities() to avoid mounting the native view on unsupported devices.
Installation
Dimensioning ships with react-native-vision-sdk.
No additional RN packages are required, but ensure your iOS build has the Vision SDK dimensioning subspec available (see native integration notes in the SDK docs).
Info.plist
Add camera and LiDAR usage descriptions to Info.plist:
No extra ARKit permission keys are required beyond these usage descriptions.
Device capability gating
Dimensioning only runs usefully on LiDAR-equipped iOS devices. Use the capability helper to gate rendering:
On simulator and on Android the helper returns all-false flags; the native view either emits LidarUnavailable or renders a placeholder.
VisionDimensioning helpers
deviceCapabilities(): Promise<DimensioningCapabilities>- returns{ lidar, arWorldTracking, sceneReconstruction }.prefetchModels(): Promise<void>- idempotent warm-up for the bundled CoreML models.
Usage tips:
prefetchModels()is optional. The models ship unencrypted and need no network, so it only saves the first capture's CoreML compile cost.deviceCapabilities()is safe to call cross-platform (stubbed on Android).
DimensioningView component
Props
Events
onError reports pre-flight problems only. The underlying iOS view exposes no error callback, so only these reach JS: iOS < 17 and non-LiDAR devices (LidarUnavailable, 2) and missing online credentials (MissingCredentials, 0). In-session failures - ArSessionFailed (3), NoGroundPlane (4), CaptureTimedOut (5), UserCancelled (6) - are not delivered. Use onTelemetry's 'measurementAborted' to detect a capture that gave up.
Commands
DimensioningView forwards a ref exposing camera control. ARKit and AVCaptureSession cannot share the rear camera, so call stop() before mounting <VisionCamera>:
Example - basic usage
Capture payload
onCapture receives a DimensioningMeasurement:
boxVertices2D holds the 8 projected box corners in the captured frame's pixel space - indices 0–3 the base face, 4–7 the top face, corner k under corner k+4. With imagePixelSize that's enough to draw the measured box over a photo. Both are empty/zero when the SDK kept no frame.
The raw JPEG is deliberately not forwarded - shipping an image across the bridge on every capture would dwarf the rest of the payload.
Live guidance - onMeasurementUpdate
Fires continuously with a coarse tracking state (searching → groundFound → boxDetected → stable) and the in-progress dimensions of every tracked box. Use it for a "hold steady… ready" HUD:
Custom overlays - onOverlayUpdate
Set overlayMode="callback" to suppress the SDK's own graphics and receive every overlay primitive each frame. All geometry arrives in view-space points, so it maps 1:1 onto the view:
This fires on every frame. Keep the handler cheap and avoid setting state you don't render.
Telemetry
Opt in with enableTelemetry and read onTelemetry:
Events go only to your handler. The SDK has no analytics backend of its own for dimensioning and makes no telemetry network calls. 'measurementAborted' is the only signal for a capture that gave up mid-session.
Cloud segmentation
mode="offline" runs entirely on-device with no network and no key. mode="online" adds a cloud segmentation step that can improve accuracy on harder surfaces, at the cost of a per-capture HTTP request; usedCloudSAM is true on results where it landed.
Pass credentials explicitly:
Leave them unset to fall back to the host app's VSDKConstants - the behaviour before these props existed. With neither set, onError fires with MissingCredentials (0).
Bundled CoreML models
The YOLO + SAM2 models ship unencrypted inside the framework as of VisionSDK 2.7.0. There is no decryption-key fetch, no first-launch network round-trip, and no Apple Developer Team requirement - dimensioning works offline from first launch for any signing team.
Before 2.7.0 the models were encrypted and scoped to PackageX's team id 964GRVV3N7; builds signed by any other team silently degraded to LiDAR-only measurement. That restriction is gone - if you worked around it, you can drop the workaround.
Troubleshooting
LidarUnavailableon-device: verify you are on a LiDAR-capable device (iPhone 12 Pro or later, iPad Pro 2020 or later) and that camera permission is granted.- Simulator: dimensioning does not function there -
deviceCapabilities()returns all-false and mountingDimensioningViewemits an error. - Android: the module is stubbed. Props and commands are accepted as no-ops and no events fire.
- No boxes detected: the whole box must be in frame with its top face visible, resting on a flat horizontal surface, roughly 40–90 cm away, held steady for 1–2 seconds. Cuboids only.
- A capture never completes: enable telemetry and read
'measurementAborted'- itsreasondistinguishes a timeout from a no-dimensions failure. - Camera conflict with
<VisionCamera>: ARKit andAVCaptureSessioncannot share the rear camera. Callstop()on the dimensioning ref before mounting the scanner, andstart()when you come back.
Known limitations
- iOS-only; Android shows a placeholder view.
onErrorcovers pre-flight failures only (see the callout above).- No imperative capture from JS.
capture(),captureAll(),shutdown(),pause(),resume()andclearCaptured()exist on the nativeDimensioningSession, but that type has no camera preview and the preview view exposes no session handle - so they cannot be driven from the RN component.stop()/start()cover the camera-release case. - The captured frame's raw JPEG is not forwarded across the bridge.
- Measurements are approximate - plan around roughly ±3–5 cm per dimension, and offer a re-capture.
Source references
- React Native SDK:
react-native-vision-sdk(DimensioningView, types, helpers) - iOS native module:
packagexlabs/vision-sdk-ios(VisionSDKDimensioning) - CocoaPods:
pod 'VisionSDK/Dimensioning'subspec in the iOS SDK distribution