react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

πŸ› Navigating away on React Native 0.78+, XCode 26, and React Native Vision Camera v4.7.1 freezes the app

Open daniel112 opened this issue 3 months ago β€’ 14 comments

What's happening?

I've noticed an odd bug where when I build the app with:

  • Xcode 26
  • React Native 0.78+
  • React Navigation 7.x+
  • React Native Vision Camera v4.7.1
  • CodeScanner property passed in
  • Isolated on a straightforward app

Running on a real device, when navigating away, the app freezes for 5+ seconds, either on navigation or after navigating away.

Some notable things:

  • CodeScanner property being passed in, this is reproducible 10/10 times, and freezes 5+ seconds
  • CodeScanner property NOT passed in, this is reproducible 5/10 times, but the freezing is < 2 seconds
  • When the Vision Camera is not rendered, the freeze does not occur

Video Demo

Can you reproduce this issue in the VisionCamera Example app?

UPDATE: I have tested with react navigation 6, and it is still freezing. so it may be related to the react-native version + Xcode 26

No, because the example app is using react native 75 and react navigation 6

Reproduceable Code

https://github.com/daniel112/react-native-vision-freeze-demo

Relevant log output

there are no obvious signs or useful output logs on XCode, but

10:08:59.988: [info] πŸ“Έ VisionCamera.configureOutputOrientation(_:): Updating Outputs rotation: portrait...
10:08:59.988: [info] πŸ“Έ VisionCamera.configureOutputs(configuration:): Successfully configured all outputs!
10:08:59.988: [info] πŸ“Έ VisionCamera.setTargetOutputOrientation(_:): Setting target output orientation from device to device...
10:09:00.382: [info] πŸ“Έ VisionCamera.init(frame:session:): Preview Layer started previewing.
10:09:00.383: [info] πŸ“Έ VisionCamera.configure(_:): Beginning AudioSession configuration...
10:09:00.383: [info] πŸ“Έ VisionCamera.configureAudioSession(configuration:): Configuring Audio Session...
10:09:00.384: [info] πŸ“Έ VisionCamera.configure(_:): Committed AudioSession configuration!
10:09:00.384: [info] πŸ“Έ VisionCamera.configure(_:): Beginning Location Output configuration...
10:09:00.385: [info] πŸ“Έ VisionCamera.configure(_:): Finished Location Output configuration!

Camera Device

{
  "maxZoom": 123.75,
  "minExposure": -8,
  "supportsRawCapture": false,
  "name": "Back Dual Wide Camera",
  "position": "back",
  "isMultiCam": true,
  "supportsFocus": true,
  "minZoom": 1,
  "hasTorch": true,
  "sensorOrientation": "portrait",
  "hasFlash": true,
  "supportsLowLightBoost": false,
  "id": "com.apple.avfoundation.avcapturedevice.built-in_video:6",
  "neutralZoom": 2,
  "minFocusDistance": 2,
  "maxExposure": 8,
  "physicalDevices": [
    "ultra-wide-angle-camera",
    "wide-angle-camera"
  ],
  "hardwareLevel": "full",
  "formats": []
}

Device

iPhone 16 (26.0)

VisionCamera Version

4.7.2

Can you reproduce this issue in the VisionCamera Example app?

No, I cannot reproduce the issue in the Example app

Additional information

daniel112 avatar Sep 25 '25 17:09 daniel112

Guten Tag, Hans here.

[!NOTE] New features, bugfixes, updates and other improvements are all handled mostly by @mrousavy in his free time. To support @mrousavy, please consider πŸ’– sponsoring him on GitHub πŸ’–. Sponsored issues will be prioritized.

maintenance-hans[bot] avatar Sep 25 '25 17:09 maintenance-hans[bot]

this seems to be more prominent when I build on xcode 26 vs xcode 16. another theory is that it is because of the new Fabric architecture being turned on

daniel112 avatar Sep 25 '25 18:09 daniel112

I've got the exact same issue. any solutions?

I'm experiencing this on:

  • react-native 0.81.4
  • vision-camera 4.7.2
  • ios only
  • real device
  • xcode 26

It works fine on xcode 16.

gigilibala avatar Sep 29 '25 19:09 gigilibala

Getting the same issue myself, but also in Xcode 16.4 as well

atm98 avatar Oct 01 '25 13:10 atm98

@mrousavy do you think this is an issue with react native vision camera?

daniel112 avatar Oct 07 '25 18:10 daniel112

Well does it work if you remove the camera or keep isActive={false}?

mrousavy avatar Oct 08 '25 12:10 mrousavy

Well does it work if you remove the camera or keep isActive={false}?

Yes, the app does not freeze if the Camera is removed completely or isActive=false

daniel112 avatar Oct 08 '25 18:10 daniel112

Same issue, vision-camera - 4.7.0, ios - 26 (it happens only with ios 26). Even if it's compiled with xcode 26 and launched on an ios 18 device, everything is fine.

dimitriiKearthrobotics avatar Oct 13 '25 16:10 dimitriiKearthrobotics

Yes, the app does not freeze if the Camera is removed completely or isActive=false

Hi @mrousavy, just wanted to check in if this is something that is being looked at? it seems like a big issue.

daniel112 avatar Oct 15 '25 15:10 daniel112

Hey - nope, I currently don't have the time to look at this. All my (very limited) free time is currently dedicated to Nitro and react-native-mmkv. In the near future I can focus on VisionCamera again.

mrousavy avatar Oct 15 '25 15:10 mrousavy

Why do I need to manually zoom in on the image for iOS to recognize it? Even when using the camera, it still fails to recognize. Is this due to some properties or settings not being configured properly, or is it just that the recognition accuracy is inherently limited? Why can’t it automatically focus on a point like Alipay does, recognizing the image without needing to zoom in or out? Is there some limitation or missing feature? @mrousavy @daniel112 @atm98 @gigilibala

nowLetsGoto avatar Oct 16 '25 03:10 nowLetsGoto

I opened PR #3650 that fixes it during my testing, but I don't know Swift. Seems like a low chance of any regressions but review is appreciated @mrousavy .

EthanDM avatar Oct 18 '25 20:10 EthanDM

have unexpectedly run into this issue too

same behaviour - navigate away, freezes until the camera goes inactive

benmag avatar Oct 31 '25 15:10 benmag

I opened PR #3650 that fixes it during my testing, but I don't know Swift. Seems like a low chance of any regressions but review is appreciated @mrousavy .

Hi @EthanDM ,

Thanks for your fix! I've successfully integrated it into our React Native app and can confirm it's working well. The fix resolved the app freeze issue we were experiencing on iOS.

We are using:

  • React Native: 0.78.0
  • XCode: 26
  • iOS: Tested on physical device (iOS 26.1)

OmarRwiheb avatar Nov 06 '25 13:11 OmarRwiheb