React-native-notifications: Permanent crash with null notifications

Created on 28 Jun 2017  路  5Comments  路  Source: wix/react-native-notifications

In some case, the notification that send to Emitter is null, so, the app will be crashed even after kill app completely. By the time the app restart, there's error "cannot read property "aps" of null" on
notification.ios.js:12:21

ReactNativJS bug iOcore 馃彋 stale

Most helpful comment

I ran into this same issue and series of steps described by @Krayen. See the referenced PR for a method for fixing.

All 5 comments

Since this seems to be the same problem I'm having at the moment, I thought I'd post some info as well. Perhaps it can help someone figuring out what the issue is.

The process is as follows: ( in the iOS simulator )

  1. Create a notification in my app by setting a firedate.
  2. Close the app by pressing Cmd + Shift + HH and swiping it upwards. I.e not just minimizing it ( everything works in that case )
  3. The notification appears as expected.
  4. When I click it, it tries to start the app and this is the result:
    skarmavbild 2017-08-31 kl 17 11 05

and this is the output I get in Reactotron:
skarmavbild 2017-08-31 kl 17 11 24

app.js

class App extends React.Component {
  componentDidMount = () => {
    initNotifications()
  }

  render() {
    return (
      <Provider store={store}><AppNavigatorWithState /></Provider>
    )
  }
}

initNotifications file

export const initNotifications = () => {
  const snoozableMedicationCategory = new NotificationCategory({
    identifier: "SNOOZABLE_MEDICATION_CATEGORY",
    actions: [snoozeMedicationAction, takenMedicationAction],
  })

  const medicationCategory = new NotificationCategory({
    identifier: "MEDICATION_CATEGORY",
    actions: [takenMedicationAction],
  })

  NotificationsIOS.addEventListener('notificationReceivedForeground', onNotificationReceivedForeground)
  NotificationsIOS.addEventListener('notificationOpened', onNotificationOpened)

  NotificationsIOS.requestPermissions([snoozableMedicationCategory, medicationCategory])
  NotificationsIOS.consumeBackgroundQueue()
}

Any solution for this?

I ran into this same issue and series of steps described by @Krayen. See the referenced PR for a method for fixing.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings