Please provide the following:
- SDK Version: 49
- Platforms(Android/iOS/web/all): IOS
- 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: