react-native-motion-manager

码农软件 · 软件分类 · 手机开发包 · 2019-05-05 15:12:36

软件介绍

react-native-motion-manager 是 CMMotionManager 对 react-native 的封装, 是 React Native 的动力传感器(加速计,陀螺计,磁力计)组件。

添加到你的项目:

  1. npm install react-native-motion-manager@latest --save

  2. 在 XCode 的项目导航右击  Libraries ➜ Add Files to [your project's name]

  3. 转到 node_modules ➜ react-native-motion-manager 然后添加 RNMotionManager.xcodeproj

  4. 在 XCode 项目导航选择你的项目,添加 libRNMotionManager.a 到你项目的 Build Phases ➜ Link Binary With Libraries

  5. 在项目导航中点击 RNMotionManager.xcodeproj 然后转向 Build Settings 标签。确保  'All' 勾选上 (替代 'Basic')。查看 Header Search Paths 确保它包括 $(SRCROOT)/../react-native/React 和 $(SRCROOT)/../../React - ,把两个都标记为 recursive

  6. 运行你的项目 (Cmd+R)

Api

安装

var {
    Accelerometer,
    Gyroscope,
    Magnetometer
} = require('NativeModules');
var {
  DeviceEventEmitter // will emit events that you can listen to
} = React;

Accelerometer

Accelerometer.setAccelerometerUpdateInterval(0.1); // in seconds
DeviceEventEmitter.addListener('AccelerationData', function (data) {
  /**
  * data.acceleration.x
  * data.acceleration.y
  * data.acceleration.z
  **/
});
Accelerometer.startAccelerometerUpdates(); // you'll start getting AccelerationData events above
Accelerometer.stopAccelerometerUpdates();

Gyroscope

Gyroscope.setGyroUpdateInterval(0.1); // in seconds
DeviceEventEmitter.addListener('GyroData', function (data) {
  /**
  * data.rotationRate.x
  * data.rotationRate.y
  * data.rotationRate.z
  **/
});
Gyroscope.startGyroUpdates(); // you'll start getting AccelerationData events above
Gyroscope.stopGyroUpdates();

Magnetomer

Magnetometer.setAccelerometerUpdateInterval(0.1); // in seconds
DeviceEventEmitter.addListener('MagnetometerData', function (data) {
  /**
  * data.magneticField.x
  * data.magneticField.y
  * data.magneticField.z
  **/
});
Magnetometer.startMagnetometerUpdates(); // you'll start getting AccelerationData events above
Magnetometer.stopMagnetometerUpdates();

本文地址:https://www.codercto.com/soft/d/5081.html

Lighttpd

Lighttpd

Andre Bogus / Packt Publishing / 2008-10 / 39.99

This is your fast guide to getting started and getting inside the Lighttpd web server. Written from a developer's perspective, this book helps you understand Lighttpd, and get it set up as securely an......一起来看看 《Lighttpd》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具