forked from paramaggarwal/react-native-device-motion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
823dc59
commit e02afd8
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,46 @@ | ||
# react-native-device-motion | ||
iOS device motion wrapper for React Native. | ||
|
||
Uses iOS CMMotionManager to provide device motion updates like roll, pitch, yaw and much more to your React Native app. | ||
|
||
## Screenshot | ||
|
||
![Screenshot of the example app](https://github.com/paramaggarwal/react-native-device-motion/raw/master/Screenshot.png) | ||
|
||
## Usage | ||
|
||
```javascript | ||
// 60fps updates | ||
DeviceMotion.startDeviceMotionUpdates(1000/60, (data) => { | ||
console.log('Raw motion data: ', data); | ||
}); | ||
|
||
// when done, | ||
DeviceMotion.stopDeviceMotionUpdates(); | ||
``` | ||
|
||
## Properties | ||
|
||
* `startDeviceMotionUpdates`: Pass an interval in `ms` and a callback to call with data. | ||
* `stopDeviceMotionUpdates`: Call to stop listening for events. | ||
|
||
## Installation | ||
|
||
Use your preferred method of including the library in your app. | ||
|
||
## Example | ||
Try the included example: | ||
|
||
```sh | ||
git clone [email protected]:paramaggarwal/react-native-device-motion.git | ||
npm install | ||
open iOS/RNTDeviceMotion.xcodeproj | ||
``` | ||
|
||
Then `Cmd+R` to start the React Packager, build and run the project in the simulator. | ||
|
||
## Author | ||
Param Aggarwal ([email protected]) | ||
|
||
## License | ||
MIT License |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.