18 October 2024

takePictureAsync() from expo-camera does not directly return the MIME type. It only returns the URI, base64, width, height, and other metadata. To get the MIME type, you can determine it based on the file extension from the URI or use a library like react-native-mime-types to infer it.

Source code viewer
  1. import { mime } from 'react-native-mime-types';
  2.  
  3. const result = await cameraRef.current.takePictureAsync();
  4. const mimeType = mime(result.uri); // Gets the MIME type based on the URI
Programming Language: ECMAScript