How to use the react-native-notifications.NotificationCategory function in react-native-notifications

To help you get started, we’ve selected a few react-native-notifications examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
identifier: 'SNOOZE_ACTION',
    }, (action, completed) => {
      this.dispatch(snoozeAlarm(action.notification.getData().alarmUUID));
      completed();
    });

    this.stopAction = new NotificationAction({
      activationMode: 'background',
      title: 'Stop',
      identifier: 'STOP_ACTION',
    }, (action, completed) => {
      this.dispatch(stopAlarm(action.notification.getData().alarmUUID));
      completed();
    });

    this.alarmActions = new NotificationCategory({
      identifier: 'ALARM',
      actions: [this.snoozeAction, this.stopAction],
      context: 'default',
    });

    this.requestPermissions().then(() => {
      this.checkStatus().catch(() => {
        this.checkStatus();
      });
    });

    // consume actions
    NotificationsIOS.consumeBackgroundQueue();
    // consume notifications
    PushNotificationIOS.getInitialNotification(0).then((notification) => {
      if (notification !== null) {
github RocketChat / Rocket.Chat.ReactNative / app / notifications / push / push.ios.js View on Github external
this.deviceToken = null;

		NotificationsIOS.addEventListener('remoteNotificationsRegistered', (deviceToken) => {
			this.deviceToken = deviceToken;
		});

		NotificationsIOS.addEventListener('notificationOpened', (notification, completion) => {
			const { background } = reduxStore.getState().app;
			if (background) {
				this.onNotification(notification);
			}
			completion();
		});

		const actions = [];
		actions.push(new NotificationCategory({
			identifier: 'MESSAGE',
			actions: [replyAction]
		}));
		NotificationsIOS.requestPermissions(actions);
	}

react-native-notifications

Advanced Push Notifications (Silent, interactive notifications) for iOS & Android

MIT
Latest version published 8 months ago

Package Health Score

70 / 100
Full package analysis