【问题标题】:When do you use react-native-push-notification vs @react-native-community/push-notification-ios?你什么时候使用 react-native-push-notification 与 @react-native-community/push-notification-ios?
【发布时间】:2020-01-26 22:33:21
【问题描述】:

我正在阅读 react-native-push-notification 的安装说明,它表明对于 iOS,您使用 @react-native-community/push-notification-ios。似乎您必须分别添加这两个模块。但是,我不明白在我的实际代码中使用哪个。你是像react-native-push-notification 中所说的那样使用var PushNotification = require("react-native-push-notification");,还是使用@react-native-community/push-notification-ios 中的import PushNotificationIOS from "@react-native-community/push-notification-ios";

【问题讨论】:

    标签: react-native push-notification apple-push-notifications react-native-push-notification


    【解决方案1】:

    你必须在你的package.json 中同时拥有这两个包,但你不需要将PushNotificationIOS 用于除了完成处理程序as shown in the usage section here 之外的任何东西。

    不过,一般来说,您只需要使用 var PushNotification = require("react-native-push-notification") 并调用您的处理程序即可。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-04
      • 1970-01-01
      • 2018-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-29
      相关资源
      最近更新 更多