File tree Expand file tree Collapse file tree 1 file changed +26
-6
lines changed Expand file tree Collapse file tree 1 file changed +26
-6
lines changed Original file line number Diff line number Diff line change 11declare module 'react-native-voip-push-notification' {
2- export type Events =
3- 'notification' |
4- 'register' |
5- 'didLoadWithEvents' ;
2+ export type NativeEvents = {
3+ register : 'RNVoipPushRemoteNotificationsRegisteredEvent' ;
4+ notification : 'RNVoipPushRemoteNotificationReceivedEvent' ;
5+ didLoadWithEvents : 'RNVoipPushDidLoadWithEvents' ;
6+ }
7+
8+ export type Events = keyof NativeEvents ;
9+ export type EventsPayload = {
10+ register : string ,
11+ notification : object ,
12+ didLoadWithEvents : Array < InitialEvent > ,
13+ }
14+
15+ export type InitialEvent = {
16+ [ Event in Events ] : { name : NativeEvents [ Event ] , data : EventsPayload [ Event ] }
17+ } [ Events ] ;
618
719 export default class RNVoipPushNotification {
8- static addEventListener ( type : Events , handler : ( args : any ) => void ) : void
20+ static RNVoipPushRemoteNotificationsRegisteredEvent : NativeEvents [ 'register' ]
21+ static RNVoipPushRemoteNotificationReceivedEvent : NativeEvents [ 'notification' ]
22+ static RNVoipPushDidLoadWithEvents : NativeEvents [ 'didLoadWithEvents' ]
23+
24+ static addEventListener < Event extends Events > (
25+ type : Event ,
26+ handler : ( args : EventsPayload [ Event ] ) => void ,
27+ ) : void
28+ static removeEventListener ( type : Events ) : void
29+
930 static registerVoipToken ( ) : void ;
1031 static onVoipNotificationCompleted ( uuid : string ) : void ;
11- static removeEventListener ( type : Events ) : void
1232 }
1333}
You can’t perform that action at this time.
0 commit comments