{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/2819","labels_url":"https://api.github.com/repos/facebook/react-native/issues/2819/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/2819/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/2819/events","html_url":"https://github.com/facebook/react-native/issues/2819","id":107068334,"number":2819,"title":"No documentation on using DeviceEventEmitter","user":{"login":"dvine-multimedia","id":996197,"avatar_url":"https://avatars.githubusercontent.com/u/996197?v=3","gravatar_id":"","url":"https://api.github.com/users/dvine-multimedia","html_url":"https://github.com/dvine-multimedia","followers_url":"https://api.github.com/users/dvine-multimedia/followers","following_url":"https://api.github.com/users/dvine-multimedia/following{/other_user}","gists_url":"https://api.github.com/users/dvine-multimedia/gists{/gist_id}","starred_url":"https://api.github.com/users/dvine-multimedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvine-multimedia/subscriptions","organizations_url":"https://api.github.com/users/dvine-multimedia/orgs","repos_url":"https://api.github.com/users/dvine-multimedia/repos","events_url":"https://api.github.com/users/dvine-multimedia/events{/privacy}","received_events_url":"https://api.github.com/users/dvine-multimedia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-17T20:31:50Z","updated_at":"2015-09-18T02:25:02Z","closed_at":null,"body":"After the release of 0.11.0 I migrated from react-native-keyboard-event to the built-in events but didn't find any documentation on how to use them. At all. After digging through the code for a while I found out how to add and (after some more digging) how to remove listeners. But there surely should be some documentation on that. If you provide a starting point I'd contribute a couple of paragraphs."},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/141310802","html_url":"https://github.com/facebook/react-native/issues/2819#issuecomment-141310802","issue_url":"https://api.github.com/repos/facebook/react-native/issues/2819","id":141310802,"user":{"login":"dvine-multimedia","id":996197,"avatar_url":"https://avatars.githubusercontent.com/u/996197?v=3","gravatar_id":"","url":"https://api.github.com/users/dvine-multimedia","html_url":"https://github.com/dvine-multimedia","followers_url":"https://api.github.com/users/dvine-multimedia/followers","following_url":"https://api.github.com/users/dvine-multimedia/following{/other_user}","gists_url":"https://api.github.com/users/dvine-multimedia/gists{/gist_id}","starred_url":"https://api.github.com/users/dvine-multimedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvine-multimedia/subscriptions","organizations_url":"https://api.github.com/users/dvine-multimedia/orgs","repos_url":"https://api.github.com/users/dvine-multimedia/repos","events_url":"https://api.github.com/users/dvine-multimedia/events{/privacy}","received_events_url":"https://api.github.com/users/dvine-multimedia/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T02:25:02Z","updated_at":"2015-09-18T02:25:02Z","body":"I have looked at those files to understand whats going on. But firstly I feel that this is an important enough subject to get covered in the main react-native docs, probably in the API section. Secondly it wasn't obvious to me at first how to remove the one listener again after registering it. The API only provides remove removeAllListeners and removeCurrentListener, both not covering what I want to do. My current solution looks as follows:\r\n\r\n```javascript\r\nvar React = require('react-native')\r\n    , DeviceEventEmitter = React.DeviceEventEmitter\r\n    , _keyboardWillShowSubscription\r\n    , _keyboardWillHideSubscription\r\n    ;\r\n\r\nvar component = React.createClass({\r\n\r\n    componentDidMount: function() {\r\n        _keyboardWillShowSubscription = DeviceEventEmitter.addListener('keyboardWillShow', (e) => console.log('keyboardWillShow', e));\r\n        _keyboardWillHideSubscription = DeviceEventEmitter.addListener('keyboardWillHide', (e) => console.log('keyboardWillHide', e));\r\n    },\r\n\r\n    componentWillUnmount: function() {\r\n        _keyboardWillShowSubscription.remove();\r\n        _keyboardWillHideSubscription.remove();\r\n    },\r\n\r\n    //...\r\n});\r\n```"}}