Skip to content

Commit 5b02761

Browse files
committed
Update PushNotificationIOS dependency
- PushNotificationIOS is being removed from React Native Core and React Native suggests moving to the community repo
1 parent 4e53d8c commit 5b02761

File tree

5 files changed

+14
-23
lines changed

5 files changed

+14
-23
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# React Native Push Notifications
2+
23
[![npm version](https://badge.fury.io/js/react-native-push-notification.svg?update=8)](http://badge.fury.io/js/react-native-push-notification)
34
[![npm downloads](https://img.shields.io/npm/dm/react-native-push-notification.svg?update=8)](http://badge.fury.io/js/react-native-push-notification)
45

@@ -38,7 +39,7 @@ Having a problem? Read the [troubleshooting](./trouble-shooting.md) guide before
3839

3940
The component uses PushNotificationIOS for the iOS part.
4041

41-
[Please see: PushNotificationIOS](https://facebook.github.io/react-native/docs/pushnotificationios.html#content)
42+
[Please see: PushNotificationIOS](https://github.com/react-native-community/react-native-push-notification-ios) for iOS installation and linking instructions.
4243

4344
## Android manual Installation
4445

@@ -125,7 +126,6 @@ In your `AndroidManifest.xml`
125126
</service>
126127
<!-- </Else> -->
127128
.....
128-
129129
```
130130

131131
In `android/settings.gradle`
@@ -174,26 +174,26 @@ public class MainApplication extends Application implements ReactApplication {
174174
## Usage
175175

176176
```javascript
177-
var PushNotification = require('react-native-push-notification');
177+
var PushNotification = require("react-native-push-notification");
178178

179179
PushNotification.configure({
180180
// (optional) Called when Token is generated (iOS and Android)
181181
onRegister: function(token) {
182-
console.log('TOKEN:', token);
182+
console.log("TOKEN:", token);
183183
},
184184

185185
// (required) Called when a remote or local notification is opened or received
186186
onNotification: function(notification) {
187-
console.log('NOTIFICATION:', notification);
187+
console.log("NOTIFICATION:", notification);
188188

189189
// process the notification
190190

191-
// required on iOS only (see fetchCompletionHandler docs: https://facebook.github.io/react-native/docs/pushnotificationios.html)
191+
// required on iOS only (see fetchCompletionHandler docs: https://github.com/react-native-community/react-native-push-notification-ios)
192192
notification.finish(PushNotificationIOS.FetchResult.NoData);
193193
},
194194

195195
// ANDROID ONLY: GCM or FCM Sender ID (product_number) (optional - not required for local notifications, but is need to receive remote push notifications)
196-
senderID: 'YOUR GCM (OR FCM) SENDER ID',
196+
senderID: "YOUR GCM (OR FCM) SENDER ID",
197197

198198
// IOS ONLY (optional): default: all - Permissions to register.
199199
permissions: {
@@ -288,7 +288,7 @@ EXAMPLE:
288288
```javascript
289289
PushNotification.localNotificationSchedule({
290290
//... You can use all the options from localNotifications
291-
message: 'My Notification Message', // (required)
291+
message: "My Notification Message", // (required)
292292
date: new Date(Date.now() + 60 * 1000) // in 60 secs
293293
});
294294
```

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
201201
* Cancels all scheduled local notifications, and removes all entries from the notification
202202
* centre.
203203
*
204-
* We're attempting to keep feature parity with the RN iOS implementation in
205-
* <a href="https://github.com/facebook/react-native/blob/master/Libraries/PushNotificationIOS/RCTPushNotificationManager.m#L289">RCTPushNotificationManager</a>.
206-
*
207-
* @see <a href="https://facebook.github.io/react-native/docs/pushnotificationios.html">RN docs</a>
208204
*/
209205
public void cancelAllLocalNotifications() {
210206
mRNPushNotificationHelper.cancelAllScheduledNotifications();
@@ -215,10 +211,6 @@ public void cancelAllLocalNotifications() {
215211
/**
216212
* Cancel scheduled notifications, and removes notifications from the notification centre.
217213
*
218-
* Note - as we are trying to achieve feature parity with iOS, this method cannot be used
219-
* to remove specific alerts from the notification centre.
220-
*
221-
* @see <a href="https://facebook.github.io/react-native/docs/pushnotificationios.html">RN docs</a>
222214
*/
223215
public void cancelLocalNotifications(ReadableMap userInfo) {
224216
mRNPushNotificationHelper.cancelScheduledNotification(userInfo);

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationAttributes.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public static RNPushNotificationAttributes fromJson(String notificationAttribute
126126
/**
127127
* User to find notifications:
128128
* <p>
129-
* https://github.com/facebook/react-native/blob/master/Libraries/PushNotificationIOS/RCTPushNotificationManager.m#L294
130129
*
131130
* @param userInfo map of fields to match
132131
* @return true all fields in userInfo object match, false otherwise

component/index.ios.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
'use strict';
1+
"use strict";
22

3-
import {
4-
AppState,
5-
PushNotificationIOS
6-
} from 'react-native';
3+
import { AppState } from "react-native";
4+
import PushNotificationIOS from "@react-native-community/push-notification-ios";
75

86
module.exports = {
97
state: AppState,
108
component: PushNotificationIOS
119
};
12-

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"type": "git",
2424
"url": "git+ssh://git@github.com:zo0r/react-native-push-notification.git"
2525
},
26+
"dependencies": {
27+
"@react-native-community/push-notification-ios": "^1.0.1"
28+
},
2629
"peerDependencies": {
2730
"react-native": ">=0.33"
2831
},

0 commit comments

Comments
 (0)