返回 Skill 列表
extension
分类: 开发与工程无需 API Key

React Native Notifications

使用Firebase或Expo Notifications为React Native推送通知。在React Native中集成Firebase或Expo推送通知时使用。

person作者: jakexiaohubgithub

React Native Notifications

Priority: P1 (HIGH)

Guidelines

  • Library: Choose @react-native-firebase/messaging (Bare) or expo-notifications (Managed).
  • Setup: Configure Platform channels (Android) and APNs (iOS).
  • Lifecycle: Handle Foreground (onMessage), Background (onNotificationOpenedApp), and Quit (getInitialNotification) states.
  • Permissions: Prime users before requesting system authorization.

See implementation examples for complete FCM handler setup with permission request and lifecycle handlers.

Anti-Patterns

  • No Unconditional Requests: Spamming permission dialogs leads to high denial rates.
  • No Missing Handlers: Forgetting "Quit" state handling results in lost deep links.
  • No Unvalidated Data: Blindly trusting payload data causes runtime crashes.

References

See references/implementation.md for FCM setup, APNs config, and lifecycle handlers.