How to use the react-native-notifications.removeEventListener 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 demokratie-live / democracy-client / src / hocs / PushNotifications.js View on Github external
componentWillUnmount() {
      switch (Platform.OS) {
        case 'ios':
          // prevent memory leaks!
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistered',
            this.onPushRegistered,
          );
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistrationFailed',
            this.onPushRegistrationFailed,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedForeground',
            this.onNotificationReceivedForeground,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedBackground',
            this.onNotificationReceivedBackground,
          );
          NotificationsIOS.removeEventListener('notificationOpened', this.onNotificationOpened);
          break;

        default:
          break;
      }
    }
github demokratie-live / democracy-client / src / hocs / PushNotifications.js View on Github external
componentWillUnmount() {
      switch (Platform.OS) {
        case 'ios':
          // prevent memory leaks!
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistered',
            this.onPushRegistered,
          );
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistrationFailed',
            this.onPushRegistrationFailed,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedForeground',
            this.onNotificationReceivedForeground,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedBackground',
            this.onNotificationReceivedBackground,
          );
          NotificationsIOS.removeEventListener('notificationOpened', this.onNotificationOpened);
          break;

        default:
          break;
github demokratie-live / democracy-client / src / hocs / PushNotifications.js View on Github external
componentWillUnmount() {
      switch (Platform.OS) {
        case 'ios':
          // prevent memory leaks!
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistered',
            this.onPushRegistered,
          );
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistrationFailed',
            this.onPushRegistrationFailed,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedForeground',
            this.onNotificationReceivedForeground,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedBackground',
            this.onNotificationReceivedBackground,
          );
          NotificationsIOS.removeEventListener('notificationOpened', this.onNotificationOpened);
github demokratie-live / democracy-client / src / hocs / PushNotifications.js View on Github external
switch (Platform.OS) {
        case 'ios':
          // prevent memory leaks!
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistered',
            this.onPushRegistered,
          );
          NotificationsIOS.removeEventListener(
            'remoteNotificationsRegistrationFailed',
            this.onPushRegistrationFailed,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedForeground',
            this.onNotificationReceivedForeground,
          );
          NotificationsIOS.removeEventListener(
            'notificationReceivedBackground',
            this.onNotificationReceivedBackground,
          );
          NotificationsIOS.removeEventListener('notificationOpened', this.onNotificationOpened);
          break;

        default:
          break;
      }
    }
github zulip / zulip-mobile / src / notification / index.js View on Github external
      this.unsubs.push(() => NotificationsIOS.removeEventListener(name, handler));
    }
github JetBrains / youtrack-mobile / src / components / push-notifications / push-notifications.ios.js View on Github external
async function onRegistrationError(e) {
      NotificationsIOS.removeEventListener('remoteNotificationsRegistrationFailed', onRegistrationError);
      log.info('PUSH: registration error', e);
      reject(e);
    }
    NotificationsIOS.addEventListener('remoteNotificationsRegistrationFailed', onRegistrationError);
github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
killActor() {
    AppState.removeEventListener('change');
    SilentSwitch.removeEventListener();

    OneSignal.removeEventListener('ids', this.onIds.bind(this));
    OneSignal.removeEventListener('received', this.onReceived.bind(this));

    NotificationsIOS.removeEventListener('notificationReceivedForeground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.removeEventListener('notificationReceivedBackground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.removeEventListener('notificationOpened', this.onNotificationOpened.bind(this));
    NotificationsIOS.resetCategories();

    if (this.TimeWatcherActor) {
      this.TimeWatcherActor.killActor(this.silent);
    }
  }
github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
killActor() {
    AppState.removeEventListener('change');
    SilentSwitch.removeEventListener();

    OneSignal.removeEventListener('ids', this.onIds.bind(this));
    OneSignal.removeEventListener('received', this.onReceived.bind(this));

    NotificationsIOS.removeEventListener('notificationReceivedForeground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.removeEventListener('notificationReceivedBackground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.removeEventListener('notificationOpened', this.onNotificationOpened.bind(this));
    NotificationsIOS.resetCategories();

    if (this.TimeWatcherActor) {
      this.TimeWatcherActor.killActor(this.silent);
    }
  }
github JetBrains / youtrack-mobile / src / components / push-notifications / push-notifications.ios.js View on Github external
async function onRegister(deviceToken): Promise {
      NotificationsIOS.removeEventListener('remoteNotificationsRegistered', onRegister);
      try {
        const url = `${KONNECTOR_URL}/ring/pushNotifications`;
        await api.makeAuthorizedRequest(url, 'POST', {token: ytToken, appleDeviceId: deviceToken});
        resolve();
      } catch (err) {
        reject(err);
      }
    }
    NotificationsIOS.addEventListener('remoteNotificationsRegistered', onRegister);
github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
killActor() {
    AppState.removeEventListener('change');
    SilentSwitch.removeEventListener();

    OneSignal.removeEventListener('ids', this.onIds.bind(this));
    OneSignal.removeEventListener('received', this.onReceived.bind(this));

    NotificationsIOS.removeEventListener('notificationReceivedForeground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.removeEventListener('notificationReceivedBackground', this.onNotificationReceivedForeground.bind(this));
    NotificationsIOS.removeEventListener('notificationOpened', this.onNotificationOpened.bind(this));
    NotificationsIOS.resetCategories();

    if (this.TimeWatcherActor) {
      this.TimeWatcherActor.killActor(this.silent);
    }
  }

react-native-notifications

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

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis