Unable to get picture sizes from expo-camera

Please provide the following:

  1. SDK Version: 49
  2. Platforms(Android/iOS/web/all): IOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.
import { Camera, CameraType } from "expo-camera";
import React, { useEffect, useRef } from "react";
import { StyleSheet } from 'react-native';

export const CameraSettings = () => {
   const cameraRef = useRef(null);
   const [status, requestPermission] = Camera.useCameraPermissions();
   useEffect(() => {
       console.log("status", status)
       if (status?.granted) {
           const setup = async () => {

               const sizes = await cameraRef.current.getAvailablePictureSizesAsync("4:3");
               console.log("cameraSizes", sizes);
           }
           setup();
       }
   }, [status?.granted])

   return (
       <React.Fragment>
           <Camera style={styles.camera} type={CameraType.back} useCamera2Api ref={cameraRef}>
           </Camera>

       </React.Fragment>

   )
}

const styles = StyleSheet.create({
   camera: {
       height: 0,
       width: 0
   }
})

I’ve tested this code with an iPad using OS 16.1.1
The result of cameraRef.current.getAvailablePictureSizesAsync(“4:3”);
is undefined

I have minimum repro in public github:

I also noticed when I take a photo with the IOS camera app the resolution is:
3024x4032

but with expo-camera I get
2376 × 3168

Hi @revolutionappdev

You might want to have a look at React Native Vision Camera. I think it might give you more control

Just one thing: The Getting Started guide tells you to run expo prebuild, but it is not necessary to prebuild because this will be done for you when you build via eas build.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.