简体   繁体   English

使用图像响应本机 iOS 推送通知

[英]React Native iOS Push Notification with Image

I currently have an app which was made with React Native.我目前有一个使用 React Native 制作的应用程序。 I need to display a local push notification, and there needs to be an image displayed within this notification.我需要显示本地推送通知,并且需要在此通知中显示图像。 Currently, I am using the react-native-push-notification library for basic text notifications.目前,我正在使用react-native-push-notification库进行基本的文本通知。

I have been looking for solutions but I have not found any way yet that I can add images into a notification.我一直在寻找解决方案,但我还没有找到任何方法可以将图像添加到通知中。 Is there some way to hook into native code that would allow me to do it?有什么方法可以挂钩本机代码,让我可以这样做吗?

Any help is greatly appreciated.任何帮助是极大的赞赏。

I am using react-native-firebase and it works great for me.我正在使用react-native-firebase ,它对我很有用。 It has an option for local notifications.它有一个本地通知选项。

You can learn more about iOS notification with an image here: https://rnfirebase.io/docs/v4.2.x/notifications/reference/IOSNotification It gives an option to set a launchImage for iOS notifications.您可以在此处了解有关带有图像的 iOS 通知的更多信息: https : launchImage它提供了为 iOS 通知设置launchImage的选项。 You should go through the documentation properly in order to install it properly.您应该正确阅读文档以正确安装它。

I have used react-native-fcm , which is implemented using react-native-firebase.我使用了react-native-fcm ,它是使用 react-native-firebase 实现的。 The support for issues are good enough and the document is well drafted for both ios and android.对问题的支持已经足够好了,而且该文档针对 ios 和 android 都起草得很好。 The pictures, icons and actions are configurable for both local and remote notifications.图片、图标和动作可配置用于本地和远程通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM