1import { UnavailabilityError } from 'expo-modules-core'; 2 3import NotificationCategoriesModule from './NotificationCategoriesModule.native'; 4import { NotificationCategory } from './Notifications.types'; 5 6/** 7 * Fetches information about all known notification categories. 8 * @return A Promise which resolves to an array of `NotificationCategory`s. On platforms that do not support notification channels, 9 * it will always resolve to an empty array. 10 * @platform android 11 * @platform ios 12 * @header categories 13 */ 14export default async function getNotificationCategoriesAsync(): Promise<NotificationCategory[]> { 15 if (!NotificationCategoriesModule.getNotificationCategoriesAsync) { 16 throw new UnavailabilityError('Notifications', 'getNotificationCategoriesAsync'); 17 } 18 19 return await NotificationCategoriesModule.getNotificationCategoriesAsync(); 20} 21