natysoz / expo-images-picker

Multiple Asset Photos Videos selecting package for Expo SDK
MIT License
95 stars 35 forks source link

Add a button to select different albums #31

Closed MarvinBai330 closed 2 years ago

MarvinBai330 commented 3 years ago

Hi, Thank you for creating such great library.

When I use this library, I found it would be good if there is a button for selecting album, instead of browsering all images.

I have a brief idea about how to implement it:

  1. Use MediaLibrary.getAlbumsAsync() to get all albums and push it input Albums[]
  2. Loop the Albums[], then
    const albumAssets = MediaLibrary.getAssetsAsync({
      first: 1,
      album: {item.id},
    });
    item.albumCover = albumAssets[0].uri

    to add a cover of each album.

  3. Loop the Albums[] to show all album's title and its cover (first image)
  4. When user click one of the albums, the function loadAssets() probably need to be added a params album: albumId for example.
  5. Done

I am new to Expo, so I don't know whether this idea is correct or not. Thanks.

natysoz commented 2 years ago

add to TODO list