Skip to main content

expo-image-picker

Version: 55.0.6 Provides access to the system’s UI for selecting images and videos from the phone’s library or taking a photo with the camera. Supports image editing, multiple selection, and customizable media types.

Installation

Usage

API Reference

Methods

(options?: ImagePickerOptions) => Promise<ImagePickerResult>
Opens the system UI for choosing an image or video from the library
(options?: ImagePickerOptions) => Promise<ImagePickerResult>
Opens the system camera for taking a photo or video
() => Promise<CameraPermissionResponse>
Requests camera permissions from the user
() => Promise<CameraPermissionResponse>
Checks current camera permission status
(writeOnly?: boolean) => Promise<MediaLibraryPermissionResponse>
Requests media library permissionsParameters:
  • writeOnly (boolean): Request write-only permissions. Defaults to false
(writeOnly?: boolean) => Promise<MediaLibraryPermissionResponse>
Checks current media library permission status
() => Promise<ImagePickerResult | null>
Retrieves pending result on Android when MainActivity is destroyed

Hooks

() => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>]
Hook for camera permissions
(options?: { writeOnly?: boolean }) => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>]
Hook for media library permissions

Types

ImagePickerOptions

MediaTypeOptions
Type of media to select. Values: All, Images, Videos
boolean
Whether to show editing UI after selection. Defaults to false
boolean
Allow selecting multiple items. Defaults to false
[number, number]
Aspect ratio for editing (e.g., [4, 3])
number
Image quality (0 to 1). Defaults to 0.2
number
Maximum video duration in seconds
UIImagePickerControllerQualityType
Video quality: 0 (High), 1 (Medium), 2 (Low)
boolean
Include EXIF data. Defaults to false
boolean
Include base64 representation. Defaults to false

ImagePickerResult

ImagePickerAsset

string
URI of the selected media
number
Width in pixels
number
Height in pixels
'image' | 'video'
Media type
string | null
Original file name
number
File size in bytes
object
EXIF metadata (if requested)
string
Base64 data (if requested)
number
Video duration in milliseconds

Enums

Examples

Pick Image from Library

Take Photo with Camera

Select Multiple Images

Pick Video with Editing

Get Image with EXIF Data

Complete Example with Permissions

Platform Support

Permissions

Camera and media library permissions are required.

iOS

Add to app.json:

Android

Permissions are automatically added:
  • READ_EXTERNAL_STORAGE / READ_MEDIA_IMAGES / READ_MEDIA_VIDEO
  • WRITE_EXTERNAL_STORAGE (Android < 10)
  • CAMERA

Best Practices

  1. Always Request Permissions: Check and request permissions before launching picker
  2. Quality Settings: Use quality: 1 for profile photos, lower for thumbnails
  3. Handle Cancellation: Always check result.canceled before accessing assets
  4. Memory Management: Be cautious with base64 on large images
  5. Multiple Selection: Don’t use allowsEditing with allowsMultipleSelection
On Android, if the system kills the activity, use getPendingResultAsync() to recover the selection. Test by enabling “Don’t keep activities” in developer options.

Resources