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.
// 60fps updates
DeviceMotion.startDeviceMotionUpdates(1000/60, (data) => {
console.log('Raw motion data: ', data);
});
// when done,
DeviceMotion.stopDeviceMotionUpdates();
startDeviceMotionUpdates
: Pass an interval inms
and a callback to call with data.stopDeviceMotionUpdates
: Call to stop listening for events.
Use your preferred method of including the library in your app.
Try the included example:
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.
Param Aggarwal ([email protected])
MIT License