首页 > 解决方案 > 如何在我的推送通知上映射一个元素?

问题描述

我使用了 React-native Push Notification,我想在我的 .map 上获取我的元素来个性化我的通知。当我使用静态字符串时一切正常。但是当我添加我的 .map 时,没有任何效果。

我的功能

renderNotif = () => {
    return this.state.sport.clubs.map((element) => {
        return (
            PushNotification.localNotificationSchedule({
                message: element.adversaire, // (required)
                date: new Date(Date.now() + 10 * 1000), // in 60 secs
            }))
    })
}

我的功能也在我的 componentDidmount 上

标签: iosreact-nativepush-notification

解决方案


推荐阅读