[media-library] “Error: Option “after” must be a valid ID!” after update to 9.0.0

🐛 Bug Report

Summary of Issue

After updating media-library to 9.0.0, MediaLibrary.getAssetsAsync() gives Error: Option "after" must be a valid ID!. Before this update if i want to get the first page of the assets i didn’t use the after prop. I think it is now required to give this prop but i don’t know what to give if i want to get the first page.

Environment – output of expo diagnostics & the platform(s) you’re targeting

Bare react native project
“react-native”: “0.63.2”
“expo-av”: “^8.5.0”,
“expo-media-library”: “^9.0.0”,
“expo-video-thumbnails”: “^4.2.1”,
“react-native-unimodules”: “^0.10.1”,

buildToolsVersion = “29.0.0”
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29

Reproducible Demo

Call MediaLibrary.getAssetsAsync() without after prop. I am using this code snippet to get the first 10 asset.

getAlbumData = async (album) => {
    try {
      var result = await MediaLibrary.getAssetsAsync({
        first: 10,
        album: album.id,
        mediaType: MediaLibrary.MediaType.video,
        sortBy: MediaLibrary.SortBy.creationTime,
      })
      if (result.totalCount > 0) {
        return { album: album, count: result.totalCount }
      }
      else {
        return null
      }
    } catch (error) {
      console.warn(error) // Error: Option "after" must be a valid ID! 
    }
  }

Steps to Reproduce

Call MediaLibrary.getAssetsAsync() without after prop.

Expected Behavior vs Actual Behavior

Expected: If after prop don’t specified, get the first page of the assets.
Actual: after prop always required.

I think it is related to this issue #9440 which closed by this pr #9466

Edit: Using “0” as after prop seems like the solution but i just want to be sure about this.

1 possible answer(s) on “[media-library] “Error: Option “after” must be a valid ID!” after update to 9.0.0