{"id":4608,"url":"https://github.com/yonahforst/react-native-heading","last_synced_at":"2025-08-04T01:32:47.943Z","repository":{"id":57337387,"uuid":"52204364","full_name":"yonahforst/react-native-heading","owner":"yonahforst","description":"Get device heading information on iOS or Android","archived":false,"fork":false,"pushed_at":"2019-07-09T11:18:13.000Z","size":13217,"stargazers_count":38,"open_issues_count":13,"forks_count":34,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-11T21:25:08.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yonahforst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-21T11:59:34.000Z","updated_at":"2023-03-13T18:38:36.000Z","dependencies_parsed_at":"2022-09-10T02:53:17.871Z","dependency_job_id":null,"html_url":"https://github.com/yonahforst/react-native-heading","commit_stats":null,"previous_names":["joshblour/react-native-heading"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonahforst%2Freact-native-heading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonahforst%2Freact-native-heading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonahforst%2Freact-native-heading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonahforst%2Freact-native-heading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yonahforst","download_url":"https://codeload.github.com/yonahforst/react-native-heading/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228242103,"owners_count":17890472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:17.773Z","updated_at":"2024-12-07T08:30:45.653Z","avatar_url":"https://github.com/yonahforst.png","language":"Java","readme":"# React Native Heading\nGet device heading information on iOS or Android\n\n## What\nReport back device orientation in degrees, 0-360, with 0 being North.\n\n#### Example\n```java\nconst { DeviceEventEmitter } = require('react-native');\nconst ReactNativeHeading = require('react-native-heading');\n\n//....\n  componentDidMount() {\n    ReactNativeHeading.start(1)\n\t.then(didStart =\u003e {\n\t\tthis.setState({\n\t\t\theadingIsSupported: didStart,\n\t\t})\n\t})\n\t\n    DeviceEventEmitter.addListener('headingUpdated', data =\u003e {\n    \tconsole.log('New heading is:', data.heading);\n    });\n\n  }\n  componentWillUnmount() {\n  \tReactNativeHeading.stop();\n  \tDeviceEventEmitter.removeAllListeners('headingUpdated');\n  }\n//...\n```\n\n| Version | React Native Support |\n|---|---|\n| 1.1.0 | 0.40.0 - 0.41.0 |\n| 1.0.0 | 0.33.0 - 0.39.0 |\n*Complies with [react-native-version-support-table](https://github.com/dangnelson/react-native-version-support-table)*\n\n#### API\n\n`start(filter)` - Start receiving heading updates. Accepts an optional filter param (int) to ignore heading changes less than the spcified threshold. The default value is 5. Returns a promise which can be used to determine if heading updates are suported by the device.\n\n`stop` - Stop receiving heaing updates (don't forget to remove the `headingUpdated` listener)\n\n\n## Setup\n\n````\nnpm install --save react-native-heading\n````\n\n### iOS\n* Run open node_modules/react-native-heading\n* Drag ReactNativeHeading.xcodeproj into your Libraries group\n\n### Android\n##### Step 1 - Update Gradle Settings\n\n```\n// file: android/settings.gradle\n...\n\ninclude ':react-native-heading'\nproject(':react-native-heading').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-heading/android')\n```\n##### Step 2 - Update Gradle Build\n\n```\n// file: android/app/build.gradle\n...\n\ndependencies {\n    ...\n    compile project(':react-native-heading')\n}\n```\n##### Step 3 - Register React Package\n```\n...\nimport com.joshblour.reactnativeheading.ReactNativeHeadingPackage; // \u003c--- import\n\npublic class MainActivity extends ReactActivity {\n\n    ...\n\n    @Override\n    protected List\u003cReactPackage\u003e getPackages() {\n        return Arrays.\u003cReactPackage\u003easList(\n            new MainReactPackage(),\n            new ReactNativeHeadingPackage() // \u003c------ add the package\n        );\n    }\n\n    ...\n}\n```\n","funding_links":[],"categories":["Components"],"sub_categories":["System"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonahforst%2Freact-native-heading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyonahforst%2Freact-native-heading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonahforst%2Freact-native-heading/lists"}