React Native Camera Integration: Permissions, Photo Capture, QR Scanning, and Uploads
CameraQR ScanningPermissionsExpoNative Modules

React Native Camera Integration: Permissions, Photo Capture, QR Scanning, and Uploads

NNative Dev Hub
2026-12-01
6 min read

Plan a reliable React Native camera feature with permissions, capture, QR scanning, lifecycle handling, validation, and secure uploads.

Adding a camera to a React Native app is more than rendering a preview: you must declare capabilities, request permission at the right time, manage the camera lifecycle, capture or scan reliably, and upload only validated files. This guide compares practical package choices, shows a repeatable implementation workflow, and provides a way to estimate integration effort before you commit to a design.

Overview

A production camera feature usually contains six separate parts:

  1. Capability declarations: iOS and Android must know that the application may use the camera, and often the microphone if video or audio is involved.
  2. Permission UX: explain why access is needed, request it in context, and provide a recovery path when access is denied.
  3. Preview and lifecycle: mount the camera only when it is needed, pause or unmount it when the screen loses focus, and avoid competing camera instances.
  4. Capture or scanning: take a photo, scan a QR code, or support both modes without allowing callbacks to fire repeatedly.
  5. Image processing: validate dimensions, orientation, format, and file size before upload.
  6. Secure transport: send the file over an authenticated connection and validate it again on the server.

For an Expo-based project, expo-camera is a natural starting point for previews, photo capture, and barcode scanning. expo-image-picker is useful when users may choose an existing image, but it does not replace a live camera preview. In a bare or prebuild-based application, a native-focused package such as VisionCamera may be a better fit when you need advanced frame processing, high-throughput scanning, or detailed device controls. Package APIs and workflow requirements change, so confirm the documentation for the versions used by your project.

OptionGood fitCheck before choosing
Expo CameraExpo projects needing preview, still photos, and basic barcode or QR scanningSupported barcode types, navigation lifecycle, and the native configuration generated by your Expo SDK
VisionCameraAdvanced camera controls, frame processors, and performance-sensitive scanningNative setup, permissions, worklets or frame-processing dependencies, and development-build requirements
Image PickerGallery selection or a fallback when camera access is unavailableAsset URI behavior, file conversion, editing options, and upload validation

How to estimate

Estimate the feature by counting capabilities rather than treating “camera integration” as one task. Start with a base implementation containing one preview and one capture action. Add one effort unit for each additional concern: QR scanning, gallery fallback, compression, upload retry, offline handling, custom overlays, orientation rules, video, frame analysis, and analytics.

A simple planning formula is:

Integration scope = base camera + platform setup + user flows + processing + upload + testing

Rate every item as low, medium, or high complexity. A still-photo flow with a single upload endpoint may be low. A document scanner with edge detection, portrait and landscape support, retry behavior, and server-side verification is likely high. This estimate is not a delivery promise; it is a way to expose hidden requirements before implementation.

Also count the test matrix. At minimum, plan for an iOS device, an Android device, a denied permission state, a previously denied permission that must be changed in system settings, a camera already in use, poor lighting, rotation, app backgrounding, and a slow or failed upload. Emulators and simulators are useful for UI work, but they do not replace physical-camera testing.

Inputs and assumptions

Declare capabilities first

Add the camera usage description required by iOS configuration and the camera permission required by Android configuration. If recording video or audio, handle microphone capability separately. Avoid requesting permissions that the feature does not use. In Expo, keep configuration in the app configuration and verify the generated native project or development build. In a bare workflow, inspect the native iOS and Android files directly.

Request permission in context

Do not ask for camera access immediately on the first launch unless the opening screen genuinely requires it. A short explanation such as “Use your camera to scan a sign-in code” gives the user a clear reason. Your permission state should distinguish at least:

  • Not yet requested: show an explanation and a request action.
  • Granted: render the preview.
  • Denied: show a retry or settings path, plus a non-camera alternative where possible.
  • Restricted or unavailable: explain that this device or account cannot use the feature.

Test the exact behavior after reinstalling, after denying access, and after changing access in system settings. Platform permission text and operating-system rules can change, so review them when upgrading SDKs or targeting new OS versions.

Manage the camera lifecycle

Camera screens should respond to navigation focus and app state. Stop or unmount the preview when the screen is left, and restart it when the user returns if permission remains available. This reduces conflicts with other camera features and avoids presenting a stale or black preview. Guard capture and scan callbacks with a busy flag or a scanned-value lock. For QR scanning, pause scanning after the first valid result, show confirmation, and let the user deliberately scan again.

Validate before uploading

A captured asset is not automatically safe or suitable for your backend. Check that the URI exists, the MIME type is allowed, the file size is within your product limit, and the dimensions are reasonable. Preserve or correct orientation according to the package behavior. Generate a smaller derivative when full-resolution images are unnecessary. Treat client-side checks as user experience improvements, not security controls; the server must validate the multipart request and inspect the content.

A typical multipart request has an explicit field name and a filename:

const form = new FormData();
form.append('photo', {
  uri: asset.uri,
  name: 'capture.jpg',
  type: 'image/jpeg',
});

await fetch(uploadUrl, {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
  body: form,
});

Do not manually set a multipart boundary unless your networking stack specifically requires it. Add timeout, cancellation, retry, and duplicate-submission handling. For authentication and token refresh, see the React Native authentication architecture guide. For compression and storage choices, see the image picker and upload guide.

Worked examples

Example 1: Profile photo

Scope the feature as one camera preview, one still capture action, optional gallery fallback, basic crop or resize, and one authenticated upload. The main risks are permission denial, large files, incorrect orientation, and a user leaving the screen during capture. A sensible flow is: explain access, request permission, capture, show a local preview, allow retake, validate the asset, upload, and display a server-confirmed result.

Example 2: QR sign-in

Scope the feature as a live preview, QR detection, a scan lock, validation of the decoded payload, and a confirmation step. Never treat any decoded string as trusted authentication data. Validate its expected structure, expiration, and association with the current session on the server. Keep a manual-code alternative for users with denied permission or a damaged camera.

Example 3: Document capture

Count this as a larger integration because it may require an overlay, multiple pages, edge guidance, orientation handling, compression, retakes, ordering, and a resumable upload. Decide early whether the app needs a dedicated document-scanning capability or only a normal photo. This decision can change the package, native setup, test plan, and review requirements.

When to recalculate

Revisit the estimate whenever the camera package, Expo SDK, React Native version, or target operating-system versions change. Recheck it when adding video, torch control, camera switching, frame processing, document detection, background uploads, or a new authentication flow. Also recalculate after testing on new device models, because a preview that works on one physical device may expose focus, orientation, memory, or performance problems elsewhere.

Use this final checklist before calling the feature ready:

  • Capability declarations and permission text match the actual feature.
  • Permission denial has a useful explanation, settings path, and fallback.
  • The preview starts and stops with navigation and app lifecycle changes.
  • Capture and scan callbacks cannot submit duplicates.
  • Rotation, low light, camera switching, and interrupted capture have been tested.
  • Images are resized or compressed when appropriate and validated on both client and server.
  • Uploads use authenticated transport, bounded retries, cancellation, and clear failure states.
  • Physical-device tests cover both platforms and release builds, not only development mode.

For release planning, connect this work to the React Native app deployment checklist and the React Native testing strategy guide. Repeating the estimate after each scope or platform change keeps camera integration predictable without assuming that every device or package behaves the same way.

Related Topics

#Camera#QR Scanning#Permissions#Expo#Native Modules
N

Native Dev Hub

React Native Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.