How to use the expo-image-picker.MediaTypeOptions function in expo-image-picker

To help you get started, we’ve selected a few expo-image-picker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bytefury / crater-mobile / src / components / FilePicker / index.js View on Github external
chooseFile = async () => {

        setTimeout(() => {
            this.onToggleLoading()
        }, 1000);

        const { mediaType = 'Images' } = this.props

        let result = await ImagePicker.launchImageLibraryAsync({
            mediaTypes: ImagePicker.MediaTypeOptions[mediaType],
            // mediaTypes: ImagePicker.MediaTypeOptions.All,
            allowsEditing: mediaType === 'Images' ? true : false,
            base64: true,
            quality: 1,
        });

        if (!result.cancelled) {
            const { onChangeCallback, input: { onChange } } = this.props
            this.setState({ image: result.uri });

            FileSystem.readAsStringAsync(result.uri, {
                encoding: FileSystem.EncodingType.Base64
            }).then((base64) => {
                const res = { ...result, base64 }
                onChangeCallback(res)
                this.onToggleLoading()
github amandeepmittal / mobilenet-tfjs-expo / App.js View on Github external
selectImage = async () => {
    try {
      let response = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.All,
        allowsEditing: true,
        aspect: [4, 3]
      })

      if (!response.cancelled) {
        const source = { uri: response.uri }
        this.setState({ image: source })
        this.classifyImage()
      }
    } catch (error) {
      console.log(error)
    }
  }
github expo / expo / home / utils / ImageSelectionUtils.ts View on Github external
import * as ImagePicker from 'expo-image-picker';
import * as FileSystem from 'expo-file-system';
import * as MediaLibrary from 'expo-media-library';
import * as Permissions from 'expo-permissions';

const mediaOptions = {
  allowsEditing: true,
  quality: 1.0,
  allowsMultipleSelection: false,
  mediaTypes: ImagePicker.MediaTypeOptions.Images,
  exif: false,
  base64: false,
};

const directory = `${FileSystem.documentDirectory}/photos`;

async function ensurePermissionsAsync(): Promise {
  const { status } = await Permissions.askAsync(Permissions.CAMERA, Permissions.CAMERA_ROLL);
  if (status !== Permissions.PermissionStatus.GRANTED) {
    alert(
      'Cannot select a banner photo without media access! Please enable the "Camera" & "Camera Roll" permission in your system settings.'
    );
    return false;
  }
  return true;
}
github expo / expo / apps / native-component-list / src / screens / FaceDetectorScreen.tsx View on Github external
onPress={() => {
            this.showPicker(ImagePicker.MediaTypeOptions.Images);
          }}
          title="Pick photo"
github expo / expo / apps / native-component-list / src / screens / ImagePickerScreen.tsx View on Github external
          onPress={() => this.showPicker(ImagePicker.MediaTypeOptions.Images)}
          title="Pick photo"
github keybase / client / shared / util / expo-image-picker.tsx View on Github external
const mediaTypeToImagePickerMediaType = (
  mediaType: 'photo' | 'video' | 'mixed'
): ImagePicker.MediaTypeOptions =>
  mediaType === 'photo'
    ? ImagePicker.MediaTypeOptions.Images
    : mediaType === 'video'
    ? ImagePicker.MediaTypeOptions.Videos
    : ImagePicker.MediaTypeOptions.All
github keybase / client / shared / util / expo-image-picker.tsx View on Github external
const mediaTypeToImagePickerMediaType = (
  mediaType: 'photo' | 'video' | 'mixed'
): ImagePicker.MediaTypeOptions =>
  mediaType === 'photo'
    ? ImagePicker.MediaTypeOptions.Images
    : mediaType === 'video'
    ? ImagePicker.MediaTypeOptions.Videos
    : ImagePicker.MediaTypeOptions.All
github expo / expo / apps / native-component-list / src / screens / ImagePickerScreen.tsx View on Github external
          onPress={() => this.showCamera(ImagePicker.MediaTypeOptions.All)}
          title="Take photo or video"
github keybase / client / shared / util / expo-image-picker.tsx View on Github external
const mediaTypeToImagePickerMediaType = (
  mediaType: 'photo' | 'video' | 'mixed'
): ImagePicker.MediaTypeOptions =>
  mediaType === 'photo'
    ? ImagePicker.MediaTypeOptions.Images
    : mediaType === 'video'
    ? ImagePicker.MediaTypeOptions.Videos
    : ImagePicker.MediaTypeOptions.All

expo-image-picker

Provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.

MIT
Latest version published 14 days ago

Package Health Score

95 / 100
Full package analysis