mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-20 12:46:36 +08:00
Update react-native PushNotificationIOS Typings
React-Native typings are currently missing two crucial definitions when implementing iOS notifications: finish function and FetchResult strings. If a finish function is not called, the background remote notifications could be throttled. Sources: https://facebook.github.io/react-native/docs/pushnotificationios.html#finish https://github.com/facebook/react-native/blob/master/Libraries/PushNotificationIOS/PushNotificationIOS.js#L133 https://github.com/facebook/react-native/blob/master/Libraries/PushNotificationIOS/PushNotificationIOS.js#L454
This commit is contained in:
18
types/react-native/index.d.ts
vendored
18
types/react-native/index.d.ts
vendored
@@ -7160,6 +7160,12 @@ export interface PushNotification {
|
||||
* Gets the data object on the notif
|
||||
*/
|
||||
getData(): Object;
|
||||
|
||||
/**
|
||||
* iOS Only
|
||||
* Signifies remote notification handling is complete
|
||||
*/
|
||||
finish(result: string): void;
|
||||
}
|
||||
|
||||
type PresentLocalNotificationDetails = {
|
||||
@@ -7182,6 +7188,12 @@ type ScheduleLocalNotificationDetails = {
|
||||
};
|
||||
|
||||
export type PushNotificationEventName = "notification" | "localNotification" | "register" | "registrationError";
|
||||
|
||||
type FetchResult = {
|
||||
NewData: "UIBackgroundFetchResultNewData",
|
||||
NoData: "UIBackgroundFetchResultNoData",
|
||||
ResultFailed: "UIBackgroundFetchResultFailed"
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle push notifications for your app, including permission handling and icon badge number.
|
||||
@@ -7296,6 +7308,12 @@ export interface PushNotificationIOSStatic {
|
||||
* object if the app was launched by a push notification, or `null` otherwise.
|
||||
*/
|
||||
getInitialNotification(): Promise<PushNotification>;
|
||||
|
||||
/**
|
||||
* iOS fetch results that best describe the result of a finished remote notification handler.
|
||||
* For a list of possible values, see `PushNotificationIOS.FetchResult`.
|
||||
*/
|
||||
FetchResult: FetchResult;
|
||||
}
|
||||
|
||||
export interface SettingsStatic {
|
||||
|
||||
Reference in New Issue
Block a user