🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@react-native-community/push-notification-ios

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-community/push-notification-ios

React Native Push Notification API for iOS

1.11.0
latest
Source
npm
Version published
Weekly downloads
151K
2.14%
Maintainers
2
Weekly downloads
 
Created

What is @react-native-community/push-notification-ios?

@react-native-community/push-notification-ios is a React Native module that provides support for push notifications on iOS. It allows developers to handle push notifications, manage notification permissions, and interact with the notification center.

What are @react-native-community/push-notification-ios's main functionalities?

Requesting Notification Permissions

This feature allows you to request permission from the user to send notifications. The code sample demonstrates how to request permissions and log the granted permissions.

import { PushNotificationIOS } from '@react-native-community/push-notification-ios';

PushNotificationIOS.requestPermissions().then((permissions) => {
  console.log(permissions);
});

Handling Incoming Notifications

This feature allows you to handle incoming notifications. The code sample shows how to add an event listener for notifications and log the received notification.

import { PushNotificationIOS } from '@react-native-community/push-notification-ios';

PushNotificationIOS.addEventListener('notification', (notification) => {
  console.log('Notification received:', notification);
});

Scheduling Local Notifications

This feature allows you to schedule local notifications. The code sample demonstrates how to schedule a notification to be fired 1 minute later.

import { PushNotificationIOS } from '@react-native-community/push-notification-ios';

const date = new Date(Date.now() + 60 * 1000); // Schedule notification for 1 minute later
PushNotificationIOS.scheduleLocalNotification({
  alertTitle: 'Scheduled Notification',
  alertBody: 'This is a scheduled notification.',
  fireDate: date.toISOString(),
});

Cancelling All Local Notifications

This feature allows you to cancel all pending local notifications. The code sample shows how to remove all pending notifications.

import { PushNotificationIOS } from '@react-native-community/push-notification-ios';

PushNotificationIOS.removeAllPendingNotifications();

Other packages similar to @react-native-community/push-notification-ios

Keywords

react-native

FAQs

Package last updated on 05 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts