https://github.com/mehcode/rn-notification
React Native Cross-Platform Remote and Local Notifications
https://github.com/mehcode/rn-notification
Last synced: 5 months ago
JSON representation
React Native Cross-Platform Remote and Local Notifications
- Host: GitHub
- URL: https://github.com/mehcode/rn-notification
- Owner: mehcode
- License: mit
- Created: 2016-08-24T22:07:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-03T21:27:48.000Z (over 6 years ago)
- Last Synced: 2025-04-11T00:02:35.584Z (11 months ago)
- Language: Java
- Size: 32.2 KB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Native Notification
> React Native Cross-Platform Remote and Local Notifications
## Features
* 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)
## Install
```sh
$ npm i rn-notification --save
$ react-native link rn-notification
```
## Configure
- [Android](./docs/android.md)
- [iOS](./docs/ios.md)
## Usage
### Create (Local)
Create local notification.
```js
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(),
}
});
```
### Action (Local and Remote)
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).
```js
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.)
});
```