Skip to content

Most of notification data in eventListener returned as undefined #147

@lukebars

Description

@lukebars

Hey.

I've currently done full integration as per documentation (AppDelegate .h and .m), and notification event listener returns most of the data as undefined.

    RNCPushNotificationIOS.addEventListener('localNotification', notif => {
      console.log(notif);
    });
// {"_alert": undefined, "_badgeCount": undefined, "_category": "", "_data": {"id": "1231231"}, "_fireDate": undefined, "_isRemote": undefined, "_remoteNotificationCompleteCallbackCalled": false, "_sound": undefined}

Although in the native side you can easily get fireDate etc., it results undefined in the listener.

UIApplication *app = [UIApplication sharedApplication];
NSArray *eventArray = [app scheduledLocalNotifications];
for (int i=0; i<[eventArray count]; i++)
{
    UILocalNotification* oneEvent = [eventArray objectAtIndex:i];
    NSLog(@"notifs hello %@", oneEvent);
}
// notifs hello <UIConcreteLocalNotification: 0x600003561e00>{fire date = Wednesday, July 8, 2020 at 12:37:21 PM Eastern European Summer Time, time zone = (null), repeat interval = 0, next fire date = Wednesday, July 8, 2020 at 12:37:21 PM Eastern European Summer Time, user info = {

Notifications work alright and fire on time with message and text. What am I missing?

    RNCPushNotificationIOS.scheduleLocalNotification({
      fireDate: new Date(Date.now() + 15000).toISOString(),
      alertTitle: 'hello',
      alertBody: 'message 2',
      userInfo: { id: 1231231 },
      alertAction: 'view',
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions