How to use the expo-media-library.createAlbumAsync function in expo-media-library

To help you get started, we’ve selected a few expo-media-library 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 expo / expo / apps / native-component-list / src / screens / MediaLibrary / MediaDetailsScreen.tsx View on Github external
addToAlbum = async () => {
    const { asset } = this.props.navigation.state.params!;
    const expoAlbum = await MediaLibrary.getAlbumAsync(EXPO_ALBUM_NAME);

    if (expoAlbum) {
      await MediaLibrary.addAssetsToAlbumAsync(asset, expoAlbum);
    } else {
      await MediaLibrary.createAlbumAsync(EXPO_ALBUM_NAME, asset);
    }

    alert('Successfully added asset to Expo album!');
  }