Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function App() {
const [hasCameraPermission, setHasCameraPermission] = useState(null);
const [{ cameraRef, type }, { toggleFacing, recordVideo }] = useCamera();
useEffect(() => {
const checkPerm = async () => {
const { status } = await Permissions.askAsync(Permissions.CAMERA);
setHasCameraPermission(status === 'granted');
};
checkPerm();
}, [setHasCameraPermission]);
if (hasCameraPermission === null) {
return