how to take picture with expo camera code example

Example 1: video expo documentation

import { Video } from 'expo-av';

Example 2: Camera with expo

import React, { useState, useEffect } from 'react';
import { Text, View, TouchableOpacity } from 'react-native';
import { Camera } from 'expo-camera';

export default function App() {
  const [hasPermission, setHasPermission] = useState(null);
  const [type, setType] = useState(Camera.Constants.Type.back);

  useEffect(() => {
    (async () => {
      const { status } = await Camera.requestPermissionsAsync();
      setHasPermission(status === 'granted');
    })();
  }, []);

  if (hasPermission === null) {
    return ;
  }
  if (hasPermission === false) {
    return No access to camera;
  }
  return (
    
      
        
           {
              setType(
                type === Camera.Constants.Type.back
                  ? Camera.Constants.Type.front
                  : Camera.Constants.Type.back
              );
            }}>
             Flip 
          
        
      
    
  );
}

Tags:

Misc Example