Hey friend! We are co-hosting a conference with Software Mansion, learn more.


Provides access to user's media library.
Requires Permissions.CAMERA_ROLL permissions.

Creates an asset from existing file. The most common use case is to save a picture taken by Camera.
const { uri } = await camera.takePictureAsync();
const asset = await MediaLibrary.createAssetAsync(uri);

  • localUri (string) -- A URI to the image or video file. On Android it must be a local path, so it must start with file:///.

An object representing an asset.

Fetches a page of assets matching the provided criteria.

  • options (object)
    • first (number) -- The maximum number of items on a single page.
    • after (string) -- Asset ID of the last item returned on the previous page.
    • album (string | Album) -- Album or its ID to get assets from specific album.
    • sortBy (array) -- An array of SortBy keys. By default, all keys are sorted in descending order, however you can also pass a pair [key, ascending] where the second item is a boolean value that means whether to use ascending order. Earlier items have higher priority when sorting out the results. If empty, this method will use the default sorting that is provided by the platform.
    • mediaType (array) -- An array of MediaType types.

A promise that resolves to an object that contains following keys:
  • assets (array) -- A page of assets fetched by the query.
  • endCursor (string) -- ID of the last fetched asset. It should be passed as after option in order to get the next page.
  • hasNextPage (boolean) -- Whether there are more assets to fetch.
  • totalCount (number) -- Estimated total number of assets that match the query.

Provides more informations about an asset, including GPS location, local URI and EXIF metadata.

  • asset (string | Asset) -- Asset or its ID.

Asset object extended by additional fields listed in the table.

Deletes assets from the library. On iOS it deletes assets from all albums they belong to, while on Android it keeps all copies of them (album is strictly connected to the asset). Also, there is additional dialog on iOS that requires user to confirm this action.

  • assets (array) -- An array of assets or their IDs.

Returns true if the assets were successfully deleted.

Queries for user-created albums in media gallery.

An array of albums.

Queries for an album with a specific name.

  • albumName (string) -- Name of the album to look for.

An object representing an album if album with given name exists, otherwise returns null.

Creates an album with given name and initial asset. The asset parameter is required on Android, since it's not possible to create empty album on this platform.

  • albumName (string) -- Name of the album to create.
  • asset (string | Asset) -- Asset or its ID. Required on Android.

Newly created album.

Adds array of assets to the album.
On Android, by default it copies assets from the current album to provided one, however it's also possible to move them by passing false as copyAssets argument. In case they're copied you should keep in mind that getAssetsAsync will return duplicated assets.

  • assets (array) -- Array of assets to add.
  • album (string | Album) -- Album or its ID, to which the assets will be added.
  • copyAssets (boolean) -- Whether to copy assets to the new album instead of move them. Defaults to true. (Android only)

Resolves to true if the assets were successfully added to the album.

Removes given assets from album.
On Android, album will be automatically deleted if there are no more assets inside.

  • assets (array) -- Array of assets to remove from album.
  • album (string | Album) -- Album or its ID, from which the assets will be removed.

Returns true if the assets were successfully removed from the album.

Available on iOS only. Fetches a list of moments, which is a group of assets taken around the same place and time.

An array of albums whose type is moment.

Subscribes for updates in user's media library.

  • listener (function) -- A callback that is called when any assets have been inserted or deleted from the library. On Android it's invoked with an empty object. On iOS it's invoked with an object that contains following keys:
    • insertedAssets (array) -- Array of assets that have been inserted to the library.
    • deletedAssets (array) -- Array of assets that have been deleted from the library.

An EventSubscription object that you can call remove() on when you would like to unsubscribe the listener.

Removes all listeners.

Field nameTypePlatformsDescriptionPossible values
idstringbothInternal ID that represents an asset
filenamestringbothFilename of the asset
uristringbothURI that points to the assetassets://* (iOS), file://* (Android)
mediaTypestringbothMedia,,, MediaType.unknown
widthnumberbothWidth of the image or video
heightnumberbothHeight of the image or video
creationTimenumberbothFile creation timestamp
modificationTimenumberbothLast modification timestamp
durationnumberbothDuration of the video or audio asset
mediaSubtypesarrayiOSAn array of media subtypeshdr, panorama, stream, timelapse, screenshot, highFrameRate, livePhoto, depthEffect
albumIdstringAndroidAlbum ID that the asset belongs to
localUri *stringbothLocal URI for the asset
location *objectbothGPS location if availablelatitude: number, longitude: number or null
exif *objectbothEXIF metadata associated with the image
orientation *numberiOSDisplay orientation of the imageNumbers 1-8, see EXIF orientation specification
isFavorite *booleaniOSWhether the asset is marked as favoritetrue, false
* These fields can be obtained only by calling getAssetInfoAsync method

Field nameTypePlatformsDescriptionPossible values
assetCountnumberbothEstimated number of assets in the album
typestringiOSThe type of the assets albumalbum, moment, smartAlbum
startTime *numberiOSEarliest creation timestamp of all assets in the moment
endTime *numberiOSLatest creation timestamp of all assets in the moment
approximateLocation *objectiOSApproximated location of all assets in the momentlatitude: number, longitude: number or null
locationNames *arrayiOSNames of locations grouped in the moment
* These fields apply only to albums whose type is moment

Possible media types:
  • MediaType.unknown

Supported keys that can be used to sort getAssetsAsync results:
  • SortBy.default
  • SortBy.creationTime
  • SortBy.modificationTime
  • SortBy.mediaType
  • SortBy.width
  • SortBy.height
  • SortBy.duration