
react-native-vision-camera
Best-practices guide for React Native VisionCamera v5 setup, migration, capture, controls, outputs, and basic frame processing. Use the separate react-native-vision-camera-realtime skill for production low-latency GPU, ML, CV, Skia or WebGPU pipelines and frame-coupled overlays.
- Installs
- 708
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/margelo/react-native-skills --skill react-native-vision-camera- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads react-native-vision-camera automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
react-native-vision-camera (v5)
VisionCamera v5 is the maintained and latest version of react-native-vision-camera. It is a full Nitro Modules rewrite with a new Constraints API, Output-based architecture, in-memory Photo, and a hard break from the v4 format/prop model. Almost every v4 surface is gone or renamed — treat v5 as a new API, not an incremental upgrade.
This skill is a router. Read this file first, then load the reference that matches the task. Every reference is self-contained — do not load more than you need.
When to load which reference
- Production low-latency GPU, ML, CV, or frame-coupled overlay work: use the separate
react-native-vision-camera-realtimeskill. Load the basic frame-processing reference too only when setup or API fundamentals are also needed. - New install, getting a Camera on screen, permissions, minimum boilerplate → references/quickstart-v5.md
- Porting a v4 codebase, understanding what changed → references/migration-v4-to-v5.md (load this FIRST when the user mentions v4, takePhoto, useCameraFormat, format prop, photo/video boolean props, or CodeScanner in core)
- Porting a whole v4 screen — want a complete before/after file to transplant → references/migration-templates.md (full copy-paste templates: photo screen, video screen, frame-processor+ML, barcode scanner, pro camera)
- Choosing/attaching outputs, fps/HDR/resolution via constraints, session lifecycle → references/outputs-and-constraints.md
- Frame Processors, worklets, async frame work, pixel formats, writing a native plugin → references/frame-processors.md (load this when user says "frame processor", "worklet", "ML on frames", "Nitro plugin", "vision-camera-plugin-*")
- Capturing photos (incl. callbacks, RAW, HDR, preview image), recording video, Recorder lifecycle, manual AE/AF/AWB, exposure bias, zoom, focus → references/capture-and-controls.md
- Depth streaming, multi-cam, Skia preview, GPU resizer for ML, barcode scanner package, GPS location metadata, custom native outputs → references/advanced-features.md
When in doubt, load references/migration-v4-to-v5.md — it covers the shape of the new API by contrasting it with v4 and is the fastest orientation.
Non-negotiable rules for v5 code
These are the rules that catch people who "know" v4. Apply them without asking:
- Install the Nitro peers.
react-native-nitro-modulesandreact-native-nitro-imageare required peer deps. Frame processors additionally requirereact-native-vision-camera-workletsANDreact-native-worklets(Software Mansion's — not-core). Worklets - https://docs.swmansion.com/react-native-worklets/docs/ outputs={[...]}replacesphoto/video/frameProcessor/codeScannerprops. Create outputs withusePhotoOutput,useVideoOutput,useFrameOutput,useDepthOutput,useObjectOutput(oruseBarcodeScannerOutputfrom the barcode package) and pass them in an array. Capture methods (capturePhoto,createRecorder) live on the Output, not the Camera ref.- There is no
formatprop and nouseCameraFormat. Useconstraints={[...]}— array order = priority, descending. The Camera negotiates the closest supported config automatically, so an impossible constraint like{ fps: 99999 }never throws. takePhoto()does not exist. UsephotoOutput.capturePhoto(settings, callbacks)for in-memoryPhoto, orphotoOutput.capturePhotoToFile(...)for a file path. The default path is in-memory — do not write temp files unless explicitly asked.- Frame Processor plugins must be Nitro Modules. The v4
FrameProcessorPluginbase class,VISION_EXPORT_SWIFT_FRAME_PROCESSORmacro, andVisionCameraProxy.addFrameProcessorPluginare gone. A v5 plugin is aHybridObjectwith a typed Nitro spec. See references/frame-processors.md. - Every
Frame(andDepth) MUST be.dispose()d. The buffer pool is bounded; leaking a frame stalls the pipeline. Wrap work intry { ... } finally { frame.dispose() }. When offloading viaasyncRunner.runAsync(...), dispose inside the async callback if it returnedtrue, and dispose immediately in theelsebranch when it returnedfalse. - CodeScanner is not in core.
react-native-vision-camera-barcode-scanneris a separate package, MLKit-based on both platforms. For iOS-only object detection (QR, faces, bodies via native AVFoundation metadata, no ML dep), useuseObjectOutputfrom core. - Keep the Camera mounted; toggle
isActive. Remounting tears down the session. Integrate withuseIsFocused()from react-navigation so the session goes Idle → Ready while not on screen, and keeps preferences warm for fast resume. - Frame output
pixelFormatdefaults to'native'(zero-copy), NOT'yuv'.'native'streams in the session's negotiatednativePixelFormatwith zero conversions (it may resolve to a YUV, RGB, RAW, or'private'format; verify the actual one viaframe.pixelFormat).'yuv'picks the YUV format closest to native and is the best general-purpose CPU-accessible choice (MLKit/OpenCV/Skia);'rgb'forces a YUV-to-RGB conversion with about 2.6 times more bandwidth, so use it only when a consumer hard-requires RGB.useDepthOutputhas nopixelFormatoption. For ML consumers that require CPU-visible RGB or tensor input, preferreact-native-vision-camera-resizerover paying a per-frame RGB conversion in the Camera pipeline.
- Do not hand-clamp FPS/resolution with
Math.min/Math.max. That was a v4 workaround. In v5 the Constraints API negotiates internally — express intent and let the Camera pick. - Worklets mutate Reanimated SharedValues directly in v5. This is suitable for ordinary asynchronous UI or animation state. For frame-locked overlays, use the separate real-time skill and draw from the same frame with Skia or WebGPU.
Operating rules for this skill
- Never invent v4→v5 API shapes. If a v4 API has no documented v5 equivalent in the references, say so and link to the v5 docs — do not guess.
- Do not add documentation files (README, CHANGELOG) unless the user asks.
- Assume the user is on v5 unless they show v4 code. If they show v4 code, load references/migration-v4-to-v5.md before writing anything.
- When writing a new Camera example, default to the hook-based declarative form (
useCameraPermission+useCameraDevice+usePhotoOutput+<Camera />). Use the imperativeVisionCamera.createCameraSession(...)API only when the user asks for multi-cam or full programmatic control. - For a basic ML path whose consumer needs CPU-visible input, recommend
react-native-vision-camera-resizerover the v4-eravision-camera-resize-plugin. Route latency-critical ML, GPU inference, and live overlays toreact-native-vision-camera-realtimeinstead of prescribing the Resizer universally.
- Verify peer dependency installs. A user reporting a native crash after install 95% of the time has missed
react-native-nitro-modules,react-native-nitro-image, or (for frame processors)react-native-worklets+react-native-vision-camera-worklets.
Authoritative links
- Docs: https://visioncamera.margelo.com
llms.txtindex: https://visioncamera.margelo.com/llms.txt- V5 release notes (includes migration snippets):
gh api repos/mrousavy/react-native-vision-camera/releases/tags/v5.0.0 - Blog announcement: https://blog.margelo.com/whats-new-in-visioncamera-v5
- Main repo: https://github.com/mrousavy/react-native-vision-camera
- V4 snapshot (archived docs): https://visioncamera4.margelo.com
FAQ
What does the react-native-vision-camera skill do?
Best-practices guide for React Native VisionCamera v5 setup, migration, capture, controls, outputs, and basic frame processing. Use the separate react-native-vision-camera-realtime skill for production low-latency GPU, ML, CV, Skia or WebGPU pipelines and frame-coupled overlays.
How do I install react-native-vision-camera?
Run npx skills add https://github.com/margelo/react-native-skills --skill react-native-vision-camera in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/react-native-vision-camera/ (personal) or .claude/skills/react-native-vision-camera/ (project).
Which AI agents can use react-native-vision-camera?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is react-native-vision-camera safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains react-native-vision-camera?
It is published by margelo in margelo/react-native-skills. It has 708 recorded installs.
More from margelo/react-native-skills
react-native-mmkv
margelo/react-native-skills
Fast synchronous key-value storage for React Native via react-native-mmkv (Nitro-backed). Covers creating and configuring MMKV instances, reading/writing all value types (string, number, boolean, buffer), React hooks for reactive UI, value-change listeners, encryption, AsyncStorage migration, and state-management integrations (zustand, redux-persist, jotai, react-query). Also covers storage limits, multi-process mode, and the V4 upgrade from the class-based API.
build-nitro-modules
margelo/react-native-skills
Builds and designs React Native Nitro Modules with Nitrogen, HybridObject TypeScript specs, Nitro View components, generated native implementations, zero-copy and native-state APIs, Swift/Kotlin/C++ bindings, example apps, and testing. Use when creating a Nitro Module, adding or reviewing HybridObjects, building a Nitro View (HybridView) component, designing Nitro-specific public APIs, implementing native functionality, or setting up the nitrogen codegen pipeline. Pair with api-design for general library API shape.
nitro-fetch
margelo/react-native-skills
Fast native networking primitives for React Native built on Nitro Modules — react-native-nitro-fetch, react-native-nitro-websockets, and react-native-nitro-text-decoder. Covers the fetch API, global replacement, prefetching and cold-start cache warming, the NitroWebSocket class and pre-warming, migrating from React Native's built-in WebSocket, the in-process NetworkInspector, native Perfetto / Instruments tracing, the native TextDecoder, and plugging nitro-fetch into axios via a custom adapter.
api-design
margelo/react-native-skills
Design and review predictable public APIs for TypeScript, JavaScript, React, and React Native libraries. Use when shaping exported functions, classes, hooks, options objects, event and listener APIs, error behavior, naming, cross-platform abstractions, or JS-only packages. Pair with build-nitro-modules when the library is backed by Nitro.
swift
margelo/react-native-skills
Design, implement, and review Swift APIs and Apple-platform code. Use when working on .swift files, Swift types, Foundation or AVFoundation APIs, DispatchQueue, async/await, Task, actors, MainActor, thread-affine state, or Swift-backed React Native Nitro Module implementations.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.