UNPKG

@applicaster/zapp-react-native-bridge

Version:

Applicaster Zapp React Native modules

32 lines (26 loc) 1.07 kB
import { NativeModules } from "react-native"; // eslint-disable-next-line prefer-promise-reject-errors const nullPromise = () => Promise.reject("Local Notification bridge is null"); const defaultLocalNotification = { cancelLocalNotifications: nullPromise, presentLocalNotification: nullPromise, }; const { LocalNotificationBridge = defaultLocalNotification } = NativeModules; export const localNotificationBridge = { /** * Unregister local notification. * @param {Array<String>} identifiers Array of identifiers to cancel local notifications * @return {Promise<Boolean>} response promise */ async cancelLocalNotifications(identifiers) { return LocalNotificationBridge.cancelLocalNotifications(identifiers); }, /** * Schedule local notification with payload data. * @param {Object} payload Object of payload data with local notification customization params * @return {Promise<Boolean>} response promise */ async presentLocalNotification(payload) { return LocalNotificationBridge.presentLocalNotification(payload); }, };