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:
foxmicha
2017-12-11 15:48:12 -05:00
committed by GitHub
parent b28498c247
commit 73ae35f48f

View File

@@ -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 {