Skip to content

fix: [Android] No available camera on some Samsung devices#3691

Open
moonjava2005 wants to merge 2 commits intomrousavy:mainfrom
moonjava2005:fix-no-available-camera-on-some-samsung-devices
Open

fix: [Android] No available camera on some Samsung devices#3691
moonjava2005 wants to merge 2 commits intomrousavy:mainfrom
moonjava2005:fix-no-available-camera-on-some-samsung-devices

Conversation

@moonjava2005
Copy link

@moonjava2005 moonjava2005 commented Jan 8, 2026

What

  • On some Samsung devices, the Camera cannot be opened because useCameraDevices() always returns an empty device list.
  • This issue happens frequently and intermittently, making the Camera unusable.
  • The problem occurs only on Android, and is especially common on certain Samsung models.

Why

  • This is caused by a race condition during module initialization.
  • When React Native binds constants via getConstants(), the cameraProvider may not be fully initialized yet, causing the exported device list to be empty.
  • Although previous PRs attempted to mitigate this by initializing earlier, the issue is not fully resolved, and still happens frequently on newer Samsung devices.
  • Additionally, native events related to camera device changes may be emitted before the React Native JS runtime is ready.
    If such events are sent too early, the JS layer will never receive them, resulting in a permanently empty device list.

How

  • Add a new exported native method to retrieve the current camera device list directly from cameraProvider, instead of relying solely on the one-time value from getConstants().

  • Update the JS hook logic on Android only:

    • If useCameraDevices() returns an empty list, the hook will manually invoke this native method to fetch the latest available devices.
  • This ensures the device list is always retrieved from the latest and fully initialized camera state, eliminating the race condition.


@vercel
Copy link

vercel bot commented Jan 8, 2026

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

A member of the Team first needs to authorize it.

@moonjava2005 moonjava2005 changed the title [Android] Fix no available camera on some samsung devices fix: [Android] No available camera on some Samsung devices Jan 8, 2026
@Thomas-Vargas
Copy link

I’ve been running into the same issue on Android, mainly on Samsung devices, where useCameraDevices() intermittently returns an empty list on cold start and the camera never becomes available.

I tested this fix by patching it onto react-native-vision-camera@4.7.3 in an Expo SDK 51 / React Native 0.74.5 app, and it reliably resolves the problem across repeated launches.

For reference, this is happening on production devices (Galaxy A53 5G / SM-A536U, Android 16). The fallback to querying the camera provider at runtime instead of relying on getConstants() makes a lot of sense given how intermittent the race condition is.

Thanks for putting this together — this has been a real pain point on these devices.

@soportetb
Copy link

Good day, I will apply the suggested patch; it doesn't seem like the maintainer is going to fix it anytime soon.

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.

3 participants