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.
This guide documents the React Native surface for the Vision SDK's 3D box dimensioning feature. It covers integration, usage, gating, modes, troubleshooting, known limitations, and links to source files.
Contents
- Quick overview
- Installation & permissions
- Device capability gating
VisionDimensioninghelpersDimensioningViewcomponent API and examples- Modes, model prefetching, and team-id requirements
- Telemetry & privacy
- Troubleshooting
- Source references
Quick overview
- Dimensioning provides approximate length × width × height measurements for detected boxes using ARKit + LiDAR and optional segmentation refinement (YOLO + SAM2).
- The React Native package exposes:
DimensioningView— native view component that emitsonCaptureandonError(iOS only).VisionDimensioning.deviceCapabilities()— inspect device support.VisionDimensioning.prefetchModels()— warm CoreML models used by the segmentation pipeline.
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 unsupported Android devices the helper returns all-false flags; the native view will either emit an error (LidarUnavailable) or render a placeholder.
VisionDimensioning helpers
deviceCapabilities(): Promise<DimensioningCapabilities>— returns{ lidar: boolean, arWorldTracking: boolean, sceneReconstruction: boolean }.prefetchModels(): Promise<void>— idempotent warm-up for bundled CoreML models.
Usage tips:
- Call
prefetchModels()once on app startup (after configuring your API key if you plan to usemode="online"). deviceCapabilities()is safe to call cross-platform (stubbed on Android).
DimensioningView component
Location: react-native-vision-sdk (DimensioningView implementation)
Props summary:
mode?: 'offline' | 'online'— processing mode (default:'offline').measurementUnit?: string— requested unit; currently the React Native wrapper returns captures in centimeters (cm) regardless of this prop.maximumTrackCount?: number— default5.onCapture?: (measurement: DimensioningMeasurement) => void— fired on a stable capture (iOS only).onError?: (error: DimensioningError) => void— fired on native errors (iOS only).
Important: measurementUnit is currently not honored by the React Native wrapper — captures are returned in cm.
Example — basic usage
Example — prefetch models on startup
Event payloads
onCapture receives a DimensioningMeasurement object with fields:
id,timestamp(Unix seconds)length,width,heightand their unit stringsdistanceFromCameraand unitconfidence(0.0–1.0)usedCloudSAM(boolean) — whether cloud SAM refinement was used
onError receives { code: number, message: string, reason?: string }. See the DimensioningError types exported by react-native-vision-sdk for error code details.
Modes & CoreML model notes
offline: segmentation/refinement runs locally where possible or pipeline falls back to LiDAR-only.online: uses cloud SAM refinement and requires an API key to be configured before starting sessions.
CoreML models used by the segmentation pipeline are encrypted and scoped to PackageX's Apple Developer Team Id 964GRVV3N7. Runtime behavior:
- If the consuming app's
DEVELOPMENT_TEAMmatches964GRVV3N7, Core ML fetches per-model decryption keys on first launch (one-time network) and caches them. - If the team id does not match, decryption fails and the SDK falls back to LiDAR-only measurements. Logs will include CoreML decryption errors.
If you plan to distribute dimensioning-enabled builds outside PackageX CI, coordinate signing/team settings with the SDK owners.
Telemetry & privacy
Dimensioning telemetry routes through the SDK's analytics (same pipeline as other features). The segmentation pipeline suppresses direct MVDimensioning PostHog routing; all telemetry flows to the SDK sink.
Consider documenting telemetry behavior in your app privacy disclosures if you enable dimensioning.
Troubleshooting
- Models fail to decrypt: ensure
DEVELOPMENT_TEAMis964GRVV3N7and device had network access on first launch. LidarUnavailableon-device: verify you are on a LiDAR-capable device (e.g., iPhone 12 Pro+), and ARKit session permissions are intact.- Simulator: dimensioning will not function on simulator —
deviceCapabilities()returns false and mountingDimensioningViewwill emit an error. - Android: the module is stubbed; do not rely on
DimensioningViewevents there.
Known limitations
- iOS-only; Android shows a placeholder view.
measurementUnitprop is currently ignored by the React Native wrapper; captures are returned in centimeters.- CoreML model encryption ties the runtime to a specific Apple Developer Team id.
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