Calendar - getCalendarsAsync return only Promise

Hi, Please help me about Calendar API.

Today i use expo-calendar and want to use createEventAsync. but it need Calendar Id so i need to call function getCalendarsAsync.
I did follow the API :

  • already asked the permission, await Permissions.getAsync(Permissions.CALENDAR);
  • the permission state is already granted
  • getCalendarsAsync();

when i console.log, i got
Promise{
“_40”:0,
“_55”:null,
“_65”:0,
“_72”:null,
}

I’m using :
expo-cli ver 3.0.4
expo-calendar ver 6.0.0,
Android

I already restart, clearing cache, and use 2 phones, but the result is same.
Thank you for reading this.

P.s : i did read forum about this one and can’t solve my problem

Hey @pakpak,

Can you make sure you’re using an async function when calling this? That error usually arises when you are not.

Cheers,
Adam

1 Like

Hi Adam,

Thanks for your advice and your reply. It’s Works !!

this is how i fix my code, if anyone wondering :
const calendar = await Calendar.getCalendarsAsync();

1 Like

Glad to be of some help. Good luck moving forward with your project!

1 Like