Skip to content

addEventListener for notification not called #438

@jzinrh

Description

@jzinrh

React Native Version: 0.73.6

Reproduction Steps:

  1. Background App
  2. Send push notification
  3. Tap push notification
    Using the following code, "entered" is never logged.
  const onRemoteNotification = (notification) => {
    console.log('entered')
    // Use the appropriate result based on what you needed to do for this notification
    const result = PushNotificationIOS.FetchResult.NoData;
    notification.finish(result);
  };

  useEffect(() => {
    const type = 'notification';
    PushNotificationIOS.addEventListener(type, onRemoteNotification);
    return () => {
      PushNotificationIOS.removeEventListener(type);
    };
  });

Notes:

  • Remote notification does show up on device; so I don't think it's a permission issue
  • Tried with both type = "notification" and "localNotification"

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