Skip to content

Conversation

@ldalzottomp
Copy link
Contributor

@ldalzottomp ldalzottomp commented Jan 28, 2026

What

This PR fixes user reports where android app shows no camera at all by changing how android initialization is done.

Changes

Note: RNVC = React Native Vision Camera

The root cause was:

  • RNVC native module were initializing camera related structure asynchronously on module load. (code)
  • RNVC rely on a initial single call to getConstants() to list devices. (next calls are cached by RN) (code)

This leads to a scenario where:

  • The first call to getConstants() is done without camera structures being initialised. Leading the function returning empty as if no devices were detected. Subsequent calls to getConstants() are cached by react-native and always returns the first result. (code)

This PR fixes this behaviour and makes sure that camera structure are initialized on demand (aka when getConstants() is called). And synchronously.
The reason why I used lazy values is to avoid the app hanging on startups while the app is initializing those structures internally.

Note: Device change listener doesn't fix the issue here, because the hook useCameraDevices, uses the getConstants() return as initial value and rely on camera registration event to be updated.

Here is an image of init log with additional lines:

Screenshot 2026-01-28 at 11 57 07 copy

The issue is super easy to reproduce. On any app, introduce an artificial delay before extensionsManager = ExtensionsManager.getInstanceAsync(reactContext, cameraProvider!!).await(executor)

Tested on

Google Pixel 7 : Android 16.

Related issues

@vercel
Copy link

vercel bot commented Jan 28, 2026

@ldalzottomp is attempting to deploy a commit to the mrousavy's Team Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant