From 4520e23b326b61322e3aae411c769a6054dc5b9e Mon Sep 17 00:00:00 2001 From: yogevbd Date: Sat, 3 Aug 2019 16:03:12 +0300 Subject: [PATCH] Fix e2e --- RNNotifications/RCTConvert+RNNotifications.m | 3 ++- example/index.ios.js | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RNNotifications/RCTConvert+RNNotifications.m b/RNNotifications/RCTConvert+RNNotifications.m index ce065cf..d499892 100644 --- a/RNNotifications/RCTConvert+RNNotifications.m +++ b/RNNotifications/RCTConvert+RNNotifications.m @@ -109,7 +109,8 @@ formattedNotification[@"body"] = RCTNullIfNil(content.body); formattedNotification[@"category"] = RCTNullIfNil(content.categoryIdentifier); formattedNotification[@"thread"] = RCTNullIfNil(content.threadIdentifier); - formattedNotification[@"data"] = [NSDictionary dictionaryWithDictionary:RCTNullIfNil(RCTJSONClean(content.userInfo))]; + + [formattedNotification addEntriesFromDictionary:[NSDictionary dictionaryWithDictionary:RCTNullIfNil(RCTJSONClean(content.userInfo))]]; return formattedNotification; } diff --git a/example/index.ios.js b/example/index.ios.js index 0e2dc64..8444280 100644 --- a/example/index.ios.js +++ b/example/index.ios.js @@ -16,12 +16,13 @@ class NotificationsExampleApp extends Component { }; this.registerNotificationEvents(); + this.setCategories(); } registerNotificationEvents() { Notifications.events().registerNotificationReceived((notification, completion) => { this.setState({ - notifications: [...this.state.notifications, notification.data.link] + notifications: [...this.state.notifications, notification.link] }); completion({alert: true, sound: false, badge: false}); @@ -29,7 +30,7 @@ class NotificationsExampleApp extends Component { Notifications.events().registerRemoteNotificationOpened((response, completion) => { this.setState({ - notifications: [...this.state.notifications, `Notification Clicked: ${response.notification.data.link}`] + notifications: [...this.state.notifications, `Notification Clicked: ${response.notification.link}`] }); completion(); @@ -87,7 +88,7 @@ class NotificationsExampleApp extends Component { async componentDidMount() { const initialNotification = await Notifications.getInitialNotification(); if (initialNotification) { - this.setState({notifications: [initialNotification.data.link, ...this.state.notifications]}); + this.setState({notifications: [initialNotification.link, ...this.state.notifications]}); } } -- 2.26.2