Then, follow the basic workflow of adding interactive notifications to your app:
Follow the basic workflow of adding interactive notifications to your app:
1. Config the actions.
2. Group actions together into categories.
...
...
@@ -187,25 +172,13 @@ let upvoteAction = new NotificationAction({
buttonTitle:'title',
placeholder:'placeholder text'
}
},(action,completed)=>{
console.log("ACTION RECEIVED");
console.log(JSON.stringify(action));
// You must call to completed(), otherwise the action will not be triggered
completed();
});
letreplyAction=newNotificationAction({
activationMode:"background",
title:"Reply",
behavior:"textInput",
authenticationRequired:true,
identifier:"REPLY_ACTION"
},(action,completed)=>{
console.log("ACTION RECEIVED");
console.log(action);
completed();
});
```
...
...
@@ -216,8 +189,7 @@ We will group `upvote` action and `reply` action into a single category: `EXAMPL
```javascript
letexampleCategory=newNotificationCategory({
identifier:"EXAMPLE_CATEGORY",
actions:[upvoteAction,replyAction],
context:"default"
actions:[upvoteAction,replyAction]
});
```
...
...
@@ -249,9 +221,7 @@ The [example app](https://github.com/wix/react-native-notifications/tree/master/
-`activationMode` - Indicating whether the app should activate to the foreground or background.
-`foreground` (default) - Activate the app and put it in the foreground.
-`background` - Activate the app and put it in the background. If the app is already in the foreground, it remains in the foreground.
-`behavior` - Indicating additional behavior that the action supports.
-`default` - No additional behavior.
-`textInput` - When button is tapped, the action opens a text input. the text will be delivered to your action callback.
-`textInput` - `TextInput` payload, when supplied, the system will present text input in this action.
-`destructive` - A Boolean value indicating whether the action is destructive. When the value of this property is `true`, the system displays the corresponding button differently to indicate that the action is destructive.
-`authenticationRequired` - A Boolean value indicating whether the user must unlock the device before the action is performed.
...
...
@@ -259,9 +229,11 @@ The [example app](https://github.com/wix/react-native-notifications/tree/master/
-`identifier` - The name of the action group (must be unique).
-`actions` - An array of `NotificationAction` objects, which related to this category.
-`context` - Indicating the amount of space available for displaying actions in a notification.
-`default` (default) - Displayes up to 4 actions (full UI).
-`minimal` - Displays up tp 2 actions (minimal UI).
### `TextInput` Payload
-`buttonTitle` - Title of the `send` button.
-`placeholder` - Placeholder for the `textInput`.
#### Get and set application icon badges count (iOS only)
@@ -50,6 +53,7 @@ export default class NotificationsIOS {
* - `remoteNotificationsRegistered` : Fired when the user registers for remote notifications. The handler will be invoked with a hex string representing the deviceToken.
* - `notificationReceivedForeground` : Fired when a notification (local / remote) is received when app is on foreground state.
* - `notificationOpened`: Fired when a notification (local / remote) is opened.
* - `pushKitNotificationReceived` : Fired when a pushKit notification received when app is both on foreground and background state.