diff --git a/index.d.ts b/index.d.ts index e6616e8b96758be54de4d0f1a3c522b6770dde3b..855de54f0a26603f5f56362f5903862a9231bbe1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -24,6 +24,35 @@ declare module "react-native-fcm" { const Local = "local_notification"; } + export interface Notification { + collapse_key: string; + opened_from_tray: boolean; + from: string; + notification: { + title?: string + body: string; + icon: string; + }; + _notificationType: string; + finish(type?: string): void; + } + + export interface LocalNotification { + title?: string; + body: string; + icon?: string; + vibrate?: number; + sound?: boolean; + big_text?: string; + large_icon?: string; + priority?: string + } + + export interface ScheduleLocalNotification extends LocalNotification{ + id: string; + fire_date: number + } + export interface Subscription { remove(): void; } @@ -32,14 +61,14 @@ declare module "react-native-fcm" { static requestPermissions(): void; static getFCMToken(): Promise; static on(event: "FCMTokenRefreshed", handler: (token: string) => void): Subscription; - static on(event: "FCMNotificationReceived", handler: (notification: any) => void): Subscription; + static on(event: "FCMNotificationReceived", handler: (notification: Notification) => void): Subscription; static subscribeToTopic(topic: string): void; static unsubscribeFromTopic(topic: string): void; - static getInitialNotification(): Promise; - static presentLocalNotification(notification: any): void; + static getInitialNotification(): Promise; + static presentLocalNotification(notification: LocalNotification): void; - static scheduleLocalNotification(schedule: any): void; - static getScheduledLocalNotifications(): Promise; + static scheduleLocalNotification(schedule: LocalNotification): void; + static getScheduledLocalNotifications(): Promise; static removeAllDeliveredNotifications(): void; static removeDeliveredNotification(id: string): void;