Get rotation information (pitch, yaw, roll) - ios
$ npm install react-native-device-angles --save
or
$ yarn add react-native-device-angles
$ react-native link react-native-device-angles
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-device-angles
and addDeviceAngles.xcodeproj
- In XCode, in the project navigator, select your project. Add
libDeviceAngles.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
import { DeviceEventEmitter } from 'react-native';
import DeviceAngles from 'react-native-device-angles';
DeviceAngles.setDeviceMotionUpdateInterval(0.1);
...
DeviceAngles.startMotionUpdates();
...
DeviceEventEmitter.addListener('AnglesData', function (data) {
console.log(data.pitch);
console.log(data.roll);
console.log(data.yaw);
});
Log 0.1.0 updated import statement by srt0422 0.1.2 Support for react-native 0.60+
ToDo improve this readme
Screens
License MIT