Skip to content

馃悰 Android: rerendering <Camera> without a previously set onPreviewStarted throws "PreviewView.onPreviewStarted: Value is null, expected an Object"聽#4208

Description

@lagudafuadtosin

Prerequisites

Reproduction

margelo/nitro#1671 (fix in Nitro). Existing harness test in visioncamera.camera-view.harness.tsx, 'reconfigures when the Camera device position prop changes'

Steps to reproduce

  1. Build the example app and run the camera-view tests on an Android phone: bun run test:harness:android -- --testPathPatterns=camera-view
  2. Watch the test named "reconfigures when the Camera device position prop changes". It fails.
  3. Or in app: show , then show it again as with onPreviewStarted left out. It throws instead of switching camera.

What did you expect to happen?

Dropping an optional callback prop on a rerender is allowed and the view just stops calling it.

What actually happened?

The rerender drops onPreviewStarted, React Native passes it as null, and Nitro's ReactProp::fromRawValue calls asObject() on it before JSIConverter<std::optional> can treat it as absent. The throw from cloneNodeWithNewProps is caught by the ErrorBoundary and the rerender never completes.

Fix in Nitro: margelo/nitro PR #1671. With it the test passes on the A14.

Affected platforms

Android (device)

Device(s) affected

Samsung Galaxy A14 (SM-A145F), Android 15, security patch 2026-05-05

VisionCamera version

5.2.3 (main at 91bae1f)

React Native version

0.85.3

React Native architecture

New Architecture (Fabric / bridgeless)

Features being used

  • Preview
  • Photo capture
  • Video capture
  • Frame Processors (worklets)
  • Skia Frame Processors
  • Code/Barcode Scanner
  • Location metadata
  • Multi-cam
  • Depth data
  • HDR / custom dynamic range
  • Custom format / FPS / resolution

Relevant logs / stack trace

[Error: Exception in HostFunction: PreviewView.onPreviewStarted: Value is null, expected an Object
Rerender timeout: Element did not update within 1000ms

Additional context

No response

Submission

  • The reproduction I linked is either (preferred) a PR against this repo that adds a failing harness test following the harness-tests README, or (fallback) a public repo that reproduces the bug on a fresh clone. I understand the issue will be closed without one.
  • I pasted logs as text (not screenshots).
  • I wrote this report in my own words. I did not paste AI-generated descriptions of the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    馃悰 bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions