界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

react-native-notifications

react-native-notifications

【效率与协作】Push notifications for React Native using Firebase or Expo Notifications. Use when integrating push notifications with Firebase or Expo in React Native.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: react-native-notifications description: Push notifications for React Native using Firebase or Expo Notifications. Use when integrating push notifications with Firebase or Expo in React Native. metadata: triggers: files: - '/notification.ts' - '/notification.tsx' - '**/App.tsx' keywords: - Notifications - messaging - FCM - expo-notifications - react-native-firebase

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.

我的收藏