{"action":"created","issue":{"url":"https://api.github.com/repos/zo0r/react-native-push-notification/issues/117","repository_url":"https://api.github.com/repos/zo0r/react-native-push-notification","labels_url":"https://api.github.com/repos/zo0r/react-native-push-notification/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/zo0r/react-native-push-notification/issues/117/comments","events_url":"https://api.github.com/repos/zo0r/react-native-push-notification/issues/117/events","html_url":"https://github.com/zo0r/react-native-push-notification/issues/117","id":162979677,"number":117,"title":"Cannot read property 'then' of null","user":{"login":"pixelgamma","id":1059964,"avatar_url":"https://avatars.githubusercontent.com/u/1059964?v=3","gravatar_id":"","url":"https://api.github.com/users/pixelgamma","html_url":"https://github.com/pixelgamma","followers_url":"https://api.github.com/users/pixelgamma/followers","following_url":"https://api.github.com/users/pixelgamma/following{/other_user}","gists_url":"https://api.github.com/users/pixelgamma/gists{/gist_id}","starred_url":"https://api.github.com/users/pixelgamma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixelgamma/subscriptions","organizations_url":"https://api.github.com/users/pixelgamma/orgs","repos_url":"https://api.github.com/users/pixelgamma/repos","events_url":"https://api.github.com/users/pixelgamma/events{/privacy}","received_events_url":"https://api.github.com/users/pixelgamma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-29T17:15:26Z","updated_at":"2016-06-30T07:27:51Z","closed_at":null,"body":"I've got this error:\r\n\r\n`Cannot read property 'then' of null`\r\n\r\nHere is my code:\r\n\r\n```\r\nimport React, { Component } from 'react';\r\n\r\nimport {\r\n  StyleSheet,\r\n  Text,\r\n  View,\r\n  TouchableOpacity,\r\n  ActionSheetIOS\r\n} from 'react-native';\r\n\r\nimport * as Animatable from 'react-native-animatable';\r\nimport Linearicon from 'react-native-vector-icons/Linearicons';\r\n\r\nimport PushNotification from 'react-native-push-notification';\r\n\r\nPushNotification.configure({\r\n\r\n    // (optional) Called when Token is generated (iOS and Android)\r\n    onRegister: function(token) {\r\n        console.log( 'TOKEN:', token );\r\n    },\r\n\r\n    // (required) Called when a remote or local notification is opened or received\r\n    onNotification: function(notification) {\r\n        console.log( 'NOTIFICATION:', notification );\r\n    },\r\n\r\n    // ANDROID ONLY: (optional) GCM Sender ID.\r\n    senderID: \"YOUR GCM SENDER ID\",\r\n\r\n    // IOS ONLY (optional): default: all - Permissions to register.\r\n    permissions: {\r\n        alert: true,\r\n        badge: true,\r\n        sound: true\r\n    },\r\n\r\n    // Should the initial notification be popped automatically\r\n    // default: true\r\n    popInitialNotification: true,\r\n\r\n    /**\r\n      * IOS ONLY: (optional) default: true\r\n      * - Specified if permissions will requested or not,\r\n      * - if not, you must call PushNotificationsHandler.requestPermissions() later\r\n      */\r\n    requestPermissions: true,\r\n});\r\n\r\nexport default class Chrono extends Component {\r\n\r\n  constructor(props) {\r\n    super(props);\r\n\r\n    this.chrono = null;\r\n  \r\n    this.state = {\r\n      isAlarmActive: false\r\n    };\r\n  }\r\n\r\n  componentDidMount() {\r\n\r\n    \r\n\r\n  }\r\n\r\n  render() {\r\n\r\n    return (\r\n      <TouchableOpacity style={styles.navBarBottomSide}\r\n        onPress={() => this.setUpAlarm(this.state.isAlarmActive)}\r\n      >\r\n        <Linearicon name=\"timer\" size={36} color=\"white\" />\r\n      </TouchableOpacity>\r\n    )\r\n\r\n  }\r\n\r\n}\r\n```\r\n\r\n![simulator screen shot 29 juin 2016 19 11 25](https://cloud.githubusercontent.com/assets/1059964/16462092/02c3a9b2-3e30-11e6-8deb-16441a9a86d7.png)\r\n\r\nWhen I put the PushNotification configuration in componentDidMount, here is what I've got:\r\n\r\n```\r\ncomponentDidMount() {\r\n\r\n       PushNotification.configure({\r\n\r\n        // (optional) Called when Token is generated (iOS and Android)\r\n        onRegister: function(token) {\r\n            console.log( 'TOKEN:', token );\r\n        },\r\n\r\n        // (required) Called when a remote or local notification is opened or received\r\n        onNotification: function(notification) {\r\n            console.log( 'NOTIFICATION:', notification );\r\n        },\r\n\r\n        // ANDROID ONLY: (optional) GCM Sender ID.\r\n        senderID: \"YOUR GCM SENDER ID\",\r\n\r\n        // IOS ONLY (optional): default: all - Permissions to register.\r\n        permissions: {\r\n            alert: true,\r\n            badge: true,\r\n            sound: true\r\n        },\r\n\r\n        // Should the initial notification be popped automatically\r\n        // default: true\r\n        popInitialNotification: true,\r\n\r\n        /**\r\n          * IOS ONLY: (optional) default: true\r\n          * - Specified if permissions will requested or not,\r\n          * - if not, you must call PushNotificationsHandler.requestPermissions() later\r\n          */\r\n        requestPermissions: true,\r\n    }); \r\n\r\n  }\r\n```\r\n![simulator screen shot 29 juin 2016 19 27 00](https://cloud.githubusercontent.com/assets/1059964/16462080/f785c3aa-3e2f-11e6-8f72-aa5e410076d3.png)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/zo0r/react-native-push-notification/issues/comments/229581053","html_url":"https://github.com/zo0r/react-native-push-notification/issues/117#issuecomment-229581053","issue_url":"https://api.github.com/repos/zo0r/react-native-push-notification/issues/117","id":229581053,"user":{"login":"sorenburon","id":6178612,"avatar_url":"https://avatars.githubusercontent.com/u/6178612?v=3","gravatar_id":"","url":"https://api.github.com/users/sorenburon","html_url":"https://github.com/sorenburon","followers_url":"https://api.github.com/users/sorenburon/followers","following_url":"https://api.github.com/users/sorenburon/following{/other_user}","gists_url":"https://api.github.com/users/sorenburon/gists{/gist_id}","starred_url":"https://api.github.com/users/sorenburon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorenburon/subscriptions","organizations_url":"https://api.github.com/users/sorenburon/orgs","repos_url":"https://api.github.com/users/sorenburon/repos","events_url":"https://api.github.com/users/sorenburon/events{/privacy}","received_events_url":"https://api.github.com/users/sorenburon/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T07:27:51Z","updated_at":"2016-06-30T07:27:51Z","body":"I experienced the same. Seems like a react native (RN) & react-native-push-notification (RNPN) version mismatch.\r\n\r\nIm on RN 0.24.1, and was using version RNPN v1.1.0 which caused the **Cannot read property 'then' of null** error.\r\n\r\nI fixed it by installing version 1.0.7 of RNPN.\r\n\r\n"}}
{"actor":{"display_login":"sorenburon"}}