---
title: expo-camera/next is ready for a close up
authors: Alan Hughes
published: February 13, 2024
categories: Product
tags: SDK 50, dev tools
---

In [Expo SDK 50](https://expo.dev/changelog/2024/01-18-sdk-50), we released `expo-camera/next` - this takes one of our oldest and most popular libraries and brings it up to date with native platform best practices.

Accessing the device camera is a fundamental capability of mobile apps and we believe that this should be both simple and reliable. In the time since its initial release in 2018, `expo-camera` has gained a number of features that, while useful, could also be considered “niche” use cases that greatly increased the complexity of the library for a small return. 

Some examples of this are pausing and resuming the camera preview and the texture integration with `expo-gl`. Recently, with the introduction of libraries like [`react-native-vision-camera`](https://react-native-vision-camera.com/) that target these more advanced use cases, it was time for us to revisit `expo-camera` and redefine it’s place in the React Native ecosystem: we want it to be **modern**, **stable**, **easy to use**, and to handle the common cases for using a camera in most apps.

## Our goals for expo-camera/next

- **Rewrite the Android implementation using `CameraX`** ([the recommended API by Google](https://developer.android.com/media/camera/camerax)).
- **Improve barcode scanning reliability**, and add support for [**DataScannerViewController**](https://www.notion.so/Introducing-expo-camera-next-28796bb2132a4035ae1a07c6e5166d68?pvs=21) on devices running iOS 16+
- **Make most configuration options available through props**, to prevent issues like [https://github.com/expo/expo/pull/23834](https://github.com/expo/expo/pull/23834)
- **Remove niche features** that would require using brittle lower-level camera APIs, rather than the modern, recommended APIs. For example, `whiteBalance` and `focusDepth` are options that are handled automatically by `CameraX` by querying the current device hardware and selecting the optimal configuration.
- **Remove face detection** — it’s a fun novelty, but not what people typically want when they reach for a camera library, and if they do want it, they may want more control than the old implementation provided.

## CameraX on Android

`CameraX` is Google's answer to the powerful, but difficult to use `Camera2` API. 

`CameraX` greatly reduces the complexity of the Android implementation, while increasing the reliability on the wide range of possible Android devices your app can run on. It provides better management of the camera lifecycle, guaranteed device compatibility back to API 21, and ensures that pictures and videos are captured with the best available configuration, based on the current devices hardware. As a Jetpack library, it receives consistent attention from Google and is improving all the time. This puts `expo-camera` in a position to take advantage of new features when they arrive.

## Reliable barcode scanning

Barcode scanning is a popular feature of the camera, and something that users expect to work great out of the box. `expo-camera/next` improves the reliability of barcode scanning by building it directly into the library. 

Additionally, devices running iOS 16, now have access to [DataScannerViewController](https://developer.apple.com/documentation/visionkit/scanning_data_with_the_camera), a new API provided by `VisionKit` which provides nice features like guidance and highlighting.



![Reliable barcode scanning](https://cdn.sanity.io/images/9r24npb8/production/da24f5eb6b7628f9d77ea95f260ab1c4c4cf754e-380x822.jpg)

## Configuration through props

In the legacy `expo-camera` API, configuration options were passed to the `takePictureAsync()` and `recordAsync()` functions. The problem with this is when you make configuration changes, the camera preview flickers as it reloads with the new configuration. When this is done just before a picture is taken, you might capture this flicker, leading to dark frames or blurry images. 

In `expo-camera/next` configuration changes will never happen at the time the picture or video is about to be captured. Configuration is done through props, this means that the camera can be configured correctly before attempting to take a picture leading to consistent image and video quality.

### Example expo-camera/next usage

```jsx
<CameraView
  ref={cameraRef}
  style={styles.camera}
/>
```

Changes to the API have been kept to a minimum. We have renamed the component to `CameraView`, added new props and removed others. The callbacks have kept the same names as before so migrating should just involve changing some names on the component itself. [Learn more in the expo-camera/next documentation](https://docs.expo.dev/versions/v50.0.0/sdk/camera-next/).

### Try out expo-camera/next!

We would love to get your feedback! `expo-camera/next` will remain in beta throughout the SDK 50 lifecycle, after which we will deprecate and archive the legacy API. Please reach out to us in [our Discord]() or [on social](https://twitter.com/expo) with any issues or suggestions you may have so we can deliver a smooth stable release with SDK 51.