I'm using React 0.44 and the project was created from Expo XDE (https://expo.io) by using $ exp detach command.
Here my code:
// constructor
// Notification interaction
let gotItAction = new NotificationAction({
activationMode: "background", // foreground: open the app when user click action
// title: String.fromCodePoint(0x1F44D),
title: 'Got it!',
identifier: "GOT_IT_ACTION"
}, (action, completed) => {
console.log("ACTION RECEIVED", action);
// console.log(JSON.stringify(action));
// You must call to completed(), otherwise the action will not be triggered
completed();
});
let cancelBookingAction = new NotificationAction({
activationMode: "background", // foreground: open the app when user click action
title: "Cancel",
identifier: "CANCEL_BOOKING_ACTION"
}, (action, completed) => {
console.log("ACTION RECEIVED", action);
// console.log(JSON.stringify(action));
completed();
});
let bookingCategory = new NotificationCategory({
identifier: "BOOKING_CATEGORY",
actions: [gotItAction, cancelBookingAction],
context: "default"
});
NotificationsIOS.requestPermissions([bookingCategory]);
// componentDidMount
NotificationsIOS.localNotification({
fireDate: date.getTime(),
alertBody: 'Your booking 1234',
alertTitle: 'Hello 123',
soundName: "chime.aiff",
category: "BOOKING_CATEGORY",
userInfo: {
bookingId: 123
}
});
I can get the notification but when i try to click to Got it! and Cancel action, i dont see any logs in my console. What i'm expected is something like this: ACTION RECEIVED .... I dont know if i missing anything
I'm using manual link the project, the follow exactly the document in readme.



same issue here
any update on this @lidanh ? @gran33
It's working on Vanilla React-Native, i used the Expo previously and it was not working so i changed to use Vanilla React-Native.
@suyogkc @sumesh1993 Please make sure following things exist in your project:
// other code
NotificationsIOS.requestPermissions();
NotificationsIOS.consumeBackgroundQueue();
// AppDelegate.m
// Required for the notification actions.
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void (^)())completionHandler
{
[RNNotifications handleActionWithIdentifier:identifier forLocalNotification:notification withResponseInfo:responseInfo completionHandler:completionHandler];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void (^)())completionHandler
{
[RNNotifications handleActionWithIdentifier:identifier forRemoteNotification:userInfo withResponseInfo:responseInfo completionHandler:completionHandler];
}
@yomybaby @daominhsangvn @suyogkc
Any updates regarding expoKit project and actionable notification callbacks? I can't make action callback works in ExpoKit
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.
Most helpful comment
It's working on Vanilla React-Native, i used the Expo previously and it was not working so i changed to use Vanilla React-Native.
@suyogkc @sumesh1993 Please make sure following things exist in your project: