Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/paramaggarwal/react-native-device-motion

iOS device motion wrapper for React Native.
https://github.com/paramaggarwal/react-native-device-motion

Last synced: 3 months ago
JSON representation

iOS device motion wrapper for React Native.

Awesome Lists containing this project

README

        

# 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