How to use the react-native-notifications.NotificationAction 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.

github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
}
        this.dispatch(updateSilentSwitchState(silent));
      }
    });

    // Push Notifications Configure
    OneSignal.addEventListener('ids', this.onIds.bind(this));
    OneSignal.addEventListener('received', this.onPushNotificationReceived.bind(this));
    OneSignal.configure();

    // Local Notifications Configure
    NotificationsIOS.addEventListener('notificationReceivedForeground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.addEventListener('notificationReceivedBackground', this.onNotificationReceivedBackground.bind(this));
    NotificationsIOS.addEventListener('notificationOpened', this.onNotificationOpened.bind(this));

    this.snoozeAction = new NotificationAction({
      activationMode: 'background',
      title: 'Snooze',
      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();
    });
github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
// Local Notifications Configure
    NotificationsIOS.addEventListener('notificationReceivedForeground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.addEventListener('notificationReceivedBackground', this.onNotificationReceivedBackground.bind(this));
    NotificationsIOS.addEventListener('notificationOpened', this.onNotificationOpened.bind(this));

    this.snoozeAction = new NotificationAction({
      activationMode: 'background',
      title: 'Snooze',
      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(() => {
github mattermost / mattermost-mobile / app / push_notifications / push_notifications.ios.js View on Github external
createReplyCategory = () => {
        const {getState} = this.reduxStore;
        const state = getState();
        const locale = getCurrentLocale(state);

        const replyTitle = getLocalizedMessage(locale, t('mobile.push_notification_reply.title'));
        const replyButton = getLocalizedMessage(locale, t('mobile.push_notification_reply.button'));
        const replyPlaceholder = getLocalizedMessage(locale, t('mobile.push_notification_reply.placeholder'));

        const replyAction = new NotificationAction({
            activationMode: 'background',
            title: replyTitle,
            textInput: {
                buttonTitle: replyButton,
                placeholder: replyPlaceholder,
            },
            authenticationRequired: true,
            identifier: REPLY_ACTION,
        });

        return new NotificationCategory({
            identifier: CATEGORY,
            actions: [replyAction],
            context: 'default',
        });
    }
github RocketChat / Rocket.Chat.ReactNative / app / notifications / push / push.ios.js View on Github external
import NotificationsIOS, { NotificationAction, NotificationCategory } from 'react-native-notifications';

import reduxStore from '../../lib/createStore';
import I18n from '../../i18n';

const replyAction = new NotificationAction({
	activationMode: 'background',
	title: I18n.t('Reply'),
	textInput: {
		buttonTitle: I18n.t('Reply'),
		placeholder: I18n.t('Type_message')
	},
	identifier: 'REPLY_ACTION'
});

class PushNotification {
	constructor() {
		this.onRegister = null;
		this.onNotification = null;
		this.deviceToken = null;

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