expo-image-picker
Version:
Provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.
59 lines (50 loc) • 1.74 kB
text/typescript
import { UnavailabilityError } from '@unimodules/core';
import {
PermissionResponse,
PermissionStatus,
PermissionExpiration,
} from 'unimodules-permissions-interface';
import ExponentImagePicker from './ExponentImagePicker';
import {
ImagePickerResult,
MediaTypeOptions,
ImagePickerOptions,
VideoExportPreset,
} from './ImagePicker.types';
export async function getCameraPermissionsAsync(): Promise<PermissionResponse> {
return ExponentImagePicker.getCameraPermissionsAsync();
}
export async function getCameraRollPermissionsAsync(): Promise<PermissionResponse> {
return ExponentImagePicker.getCameraRollPermissionsAsync();
}
export async function requestCameraPermissionsAsync(): Promise<PermissionResponse> {
return ExponentImagePicker.requestCameraPermissionsAsync();
}
export async function requestCameraRollPermissionsAsync(): Promise<PermissionResponse> {
return ExponentImagePicker.requestCameraRollPermissionsAsync();
}
export async function launchImageLibraryAsync(
options: ImagePickerOptions = {}
): Promise<ImagePickerResult> {
if (!ExponentImagePicker.launchImageLibraryAsync) {
throw new UnavailabilityError('ImagePicker', 'launchImageLibraryAsync');
}
return await ExponentImagePicker.launchImageLibraryAsync(options);
}
export async function launchCameraAsync(
options: ImagePickerOptions = {}
): Promise<ImagePickerResult> {
if (!ExponentImagePicker.launchCameraAsync) {
throw new UnavailabilityError('ImagePicker', 'launchCameraAsync');
}
return await ExponentImagePicker.launchCameraAsync(options);
}
export {
MediaTypeOptions,
ImagePickerOptions,
ImagePickerResult,
VideoExportPreset,
PermissionResponse,
PermissionStatus,
PermissionExpiration,
};