Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Draft proposal for Push Notifications and PushNotificationiOS

Proposal for Push Notifications and PushNotificationiOS

@salakar, @ashoat, @indexzero, @swaagie, @3rdeden, and @msluther met today to discuss this. This is the draft proposal written up during that meeting. We plan to iterate on this over the next week and then post it into a new proposal in react-native-community.

Prior art

  • Push Notification packages
    • react-native-push-notification
    • react-native-notifications
      • Fork of iOS work used in react-native-fire
    • react-native-firebase
  • React Native Firebase
    • src/messaging
    • src/notifications
  • Messaging vs. Notifications
    • Message (aka "data message")
    • Notification always notifies presents a visual notification

Proposal

  1. Formally deprecate existing PushNotficiationiOS Move source code for PushNotificationiOS into it's own repo (e.g. push-notification-ios living at react-native-community/push-notification-ios).

    • This module will be immediately deprecated. Having a final installable resting place for the code is still important to support the React Native community as they upgrade to newer versions. For example: assume PushNotificationiOS is removed in react-native@X.Y.Z. If push-notification-ios does not exist in user-land React Natiive consumers will be blocked from upgrading until they migrate to the new user-land module. With the deprecated code in a blessed location they can decouple that upgrade from the migration.
  2. Create a new PushNotification "kernel" Replicate, extract, or copy messaging and notifications code from react-native-firebase into a new codebase (e.g. react-native-community/react-native-push if not taken already).

    • Please see "Requirements" below.
    • The final future API for this library is TBD – we want input from the community to help finalize it.
    • By separating this from react-native-firebase more folks can contribute to it without needing to fully understand all of the additional features react-native-firebase offers.

Implications for react-native core

  • Formally deprecate PushNotificationiOS in react-native@0.XX
  • Remove PushNotificationiOS in react-native@0.XX
  • Provide guidance for receiving a notification while the JS runtime is off.
    • Only supported by Android currently.
    • Was brought up as having JSI implications for React Native by @ashoat
  • Also see other "Open Questions" below.

Requirements

Further reading

Open Questions

  • How can we support other services? (e.g. OneSignal, Expo, etc.)
    • These should all desugar to FCM or APN under the covers
  • Surface requirements around JSI to React Native core team (e.g. receiving a notification while the JS runtime is off).
    • Only supported by Android currently
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment