Complete the code to import the CameraView component from expo-camera.
import { [1] } from 'expo-camera';
The correct import is Camera from expo-camera. This component allows you to access the device camera.
Complete the code to request camera permissions using the hook.
const [permission, requestPermission] = [1]();The hook useCameraPermissions is used to get and request camera permissions in expo-camera.
Fix the error in the code to check if permission is granted before rendering the camera component.
if (!permission?.[1]) { return <Text>No access to camera</Text>; }
The permission object has a granted property that is true when the user has allowed camera access.
Fill both blanks to render the CameraView component with the back camera facing and a style.
<CameraView facing=[1] style=[2] />
The back camera is selected with "back". The style { flex: 1 } makes the camera fill the available space.
Fill all three blanks to request permission on button press and handle the response.
async function askPermission() {
const { status } = await [1]();
if (status === [2]) {
[3](true);
} else {
[3](false);
}
}The function requestPermission asks the user for camera access. The status is compared to the string "granted". The state setter setHasPermission updates the permission state.