React Native Cross-Platform Remote and Local Notifications
- Local (from JavaScript)
- Remote (from Push API)
- 100% Support for all Application States (background, foreground, killed, etc.)
- Supports FCM (which can be used with GCM API)
$ npm i rn-notification --save
$ react-native link rn-notification
Create local notification.
import Notification from "rn-notification";
Notification.create({
subject: "Biltong",
message: "Bacon ipsum dolor amet corned beef biltong picanha sirloin rump tail tongue, jowl kevin ham hock strip steak pastrami kielbasa.",
priority: "high",
color: "#DE3226",
sound: "alert",
smallIcon: "ic_launcher",
payload: {
random: Math.random(),
}
});
Respond to taps from a remote or local notification.
The callback is invoked regardless of where the notification came from (remote or local) or what state the application is in when it received the notification (dead, background, foreground).
import Notification from "rn-notification";
Notification.on("press", (token) => {
// Invoked when notification is pressed regardless of when it is
// pressed (foreground, background, in space, etc.)
});