Skip to content

Conversation

@EthanDM
Copy link

@EthanDM EthanDM commented Oct 18, 2025

What

Fix the navigation freeze on React Navigation/Fabric by shutting the camera session down deterministically when the view unmounts.

Changes

  • Add CameraSession.shutdown, which disables photo/video/audio/code-scanner/location/torch before flipping isActive = false, and clears delegates while removing outputs.
  • Stop both capture sessions asynchronously during CameraSession.deinit as a backstop.
  • Have CameraView call the shutdown helper on unmount/deinit, log if teardown exceeds 2 s, and guard against concurrent shutdowns.

Tested on

  • iPhone 14 Pro (iOS 26.0.1) with code scanner enabled, navigating away from the camera screen (no freeze).

Related issues

- Add shutdown method to stop all outputs and release resources
- Schedule shutdown with warning if it takes longer than expected
@vercel
Copy link

vercel bot commented Oct 18, 2025

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

A member of the Team first needs to authorize it.

@jkaufman
Copy link
Contributor

jkaufman commented Nov 8, 2025

@EthanDM Thank you for your effort on this. We’ve been testing a patch that builds on yours and would appreciate a look.

Copy link
Owner

@mrousavy mrousavy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR - seems like there were some issues with proper session shutdown on Fabric - I wonder why that wasn't a problem before on Paper. Maybe view caching/recycling?

Anyways - I left some review comments

EthanDM and others added 2 commits November 23, 2025 09:27
- Remove unnecessary delegate assignments before removing outputs
- Ensure completion block is called in all error scenarios during configuration
@EthanDM
Copy link
Author

EthanDM commented Nov 23, 2025

Thanks for the review @mrousavy, I addressed all of the comments and retested. Still no freezes during mount/unmount.

Let me know if anything else is needed.

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.

🐛 Navigating away on React Native 0.78+, XCode 26, and React Native Vision Camera v4.7.1 freezes the app

3 participants