mobile-camera-vision-camera
VisionCamera Patterns
Quick Guide: Use VisionCamera for high-performance camera features in React Native. Control the camera lifecycle with
isActive(never unmount/remount). UseuseCameraDeviceto select back/front cameras,useCameraPermissionfor permissions. Capture photos withtakePhoto(), record video withstartRecording()/stopRecording(), scan codes withuseCodeScanner, and process frames in real time withuseFrameProcessorworklets. Frame processors run on a parallel JS thread via JSI -- keep them fast or userunAsync/runAtTargetFpsto avoid blocking the pipeline.
<critical_requirements>
CRITICAL: Before Using This Skill
(You MUST set isActive based on screen focus AND app state -- camera must pause when backgrounded or navigated away)
(You MUST request permissions before rendering the Camera -- useCameraPermission returns hasPermission and requestPermission)
(You MUST include the 'worklet' directive as the first line of every frame processor function body)
(You MUST enable only the pipelines you need (photo, video, codeScanner, frameProcessor) -- unused pipelines waste resources)
(You MUST use useSharedValue (not useState) for data shared between frame processors and the React thread)