{"id":4577,"url":"https://github.com/pwmckenna/react-native-motion-manager","last_synced_at":"2025-04-09T15:04:23.676Z","repository":{"id":30232459,"uuid":"33783588","full_name":"pwmckenna/react-native-motion-manager","owner":"pwmckenna","description":"CMMotionManager wrapper for react-native","archived":false,"fork":false,"pushed_at":"2020-02-24T03:49:15.000Z","size":125,"stargazers_count":248,"open_issues_count":15,"forks_count":68,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T15:04:18.919Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-motion-manager","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pwmckenna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-11T16:39:27.000Z","updated_at":"2025-02-23T07:43:20.000Z","dependencies_parsed_at":"2022-07-27T15:15:24.900Z","dependency_job_id":null,"html_url":"https://github.com/pwmckenna/react-native-motion-manager","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwmckenna%2Freact-native-motion-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwmckenna%2Freact-native-motion-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwmckenna%2Freact-native-motion-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwmckenna%2Freact-native-motion-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwmckenna","download_url":"https://codeload.github.com/pwmckenna/react-native-motion-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055276,"owners_count":21040156,"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:16.770Z","updated_at":"2025-04-09T15:04:23.658Z","avatar_url":"https://github.com/pwmckenna.png","language":"Objective-C","funding_links":[],"categories":["Components","\u003ca name=\"Motion-Sensor:-Native-Modules\"\u003eMotion Sensor: Native Modules\u003c/a\u003e","Index"],"sub_categories":["System","Native APIs"],"readme":"# Notice\n\nI don't use this module anymore, and don't have time to maintain it. I've been handing out both github and npm write access to folks that seem interested, so feel free to ask.\n\n# react-native-motion-manager\n\nCMMotionManager wrapper for react-native, exposing Accelerometer, Gyroscope, and Magnetometer.\n\n### Add it to your project\n\n1. `npm install react-native-motion-manager@latest --save`\n2. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n3. Go to `node_modules` ➜ `react-native-motion-manager` and add `RNMotionManager.xcodeproj`\n4. In XCode, in the project navigator, select your project. Add `libRNMotionManager.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n5. Click `RNMotionManager.xcodeproj` in the project navigator and go the `Build Settings` tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for `Header Search Paths` and make sure it contains both `$(SRCROOT)/../react-native/React` and `$(SRCROOT)/../../React` - mark both as `recursive`.\n5. Run your project (`Cmd+R`)\n\n### Setup trouble?\n\nIf you get stuck, take a look at [Brent Vatne's blog](http://brentvatne.ca/packaging-react-native-component/). He was gracious enough to help out on this project, and his blog is my go to reference for this stuff.\n\n# Api\n\n### Setup\n```js\nvar {\n    Accelerometer,\n    Gyroscope,\n    Magnetometer\n} = require('NativeModules');\nvar {\n  DeviceEventEmitter // will emit events that you can listen to\n} = React;\n```\n\n\n### Accelerometer\n```js\nAccelerometer.setAccelerometerUpdateInterval(0.1); // in seconds\nDeviceEventEmitter.addListener('AccelerationData', function (data) {\n  /**\n  * data.acceleration.x\n  * data.acceleration.y\n  * data.acceleration.z\n  **/\n});\nAccelerometer.startAccelerometerUpdates(); // you'll start getting AccelerationData events above\nAccelerometer.stopAccelerometerUpdates();\n```\n\n### Gyroscope\n```js\nGyroscope.setGyroUpdateInterval(0.1); // in seconds\nDeviceEventEmitter.addListener('GyroData', function (data) {\n  /**\n  * data.rotationRate.x\n  * data.rotationRate.y\n  * data.rotationRate.z\n  **/\n});\nGyroscope.startGyroUpdates(); // you'll start getting GyroscopicData events above\nGyroscope.stopGyroUpdates();\n```\n\n### Magnetometer\n```js\nMagnetometer.setMagnetometerUpdateInterval(0.1); // in seconds\nDeviceEventEmitter.addListener('MagnetometerData', function (data) {\n  /**\n  * data.magneticField.x\n  * data.magneticField.y\n  * data.magneticField.z\n  **/\n});\nMagnetometer.startMagnetometerUpdates(); // you'll start getting MagnetomerData events above\nMagnetometer.stopMagnetometerUpdates();\n```\n\n# Example\n\nThis repo contains an example react-native app to help get you started. [Source code here.](https://github.com/pwmckenna/react-native-motion-manager/tree/master/Example/MotionExample)\n\n![](http://pwmckenna.com/react-native-motion-manager/motion.png)\n![](http://pwmckenna.com/react-native-motion-manager/accelerometer.png)\n![](http://pwmckenna.com/react-native-motion-manager/gyroscope.png)\n![](http://pwmckenna.com/react-native-motion-manager/magnetometer.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwmckenna%2Freact-native-motion-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwmckenna%2Freact-native-motion-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwmckenna%2Freact-native-motion-manager/lists"}